No matter what I do (Euler & Quaternion), I always get the same angle:
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FjokD1mn.jpg&hash=52ee86c526998df5849ebd27d081b650b5784910)
when I want this angle:
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FirYvU9C.jpg&hash=c6d97e43f9ebf5a60b3589afe1fbc4430b91994b)
Any idea?
Have you tried
http://forum.liberty-unleashed.co.uk/index.php/topic,1771.0.html ?
This is a bug that really needs to be solved..
I hope you didn't do a lot of vehicle saving at once >:( :-[..
Quote from: Mötley on Nov 26, 2016, 12:03 AMHave you tried
http://forum.liberty-unleashed.co.uk/index.php/topic,1771.0.html ?
This is a bug that really needs to be solved..
I hope you didn't do a lot of vehicle saving at once >:( :-[..
10 vehicles. And yes, I already tried this and same result.
I will figure something out, Unless someone better than me finds out a better method.
But for now.. I had used player.Angle in the past.. But you need to drive straight to where you want the car, From what I remember, No direct car spawn, enter, turn save, etc..
Something like this should buy you some time until someone else helps,.. :-\
if (cmd == "angle")
{
if (player.Vehicle)
{
print("Broken Angle " + player.Vehicle.Angle)
player.Vehicle.Angle = player.Angle;
print("New Angle " + player.Vehicle.Angle)
/* In-case something weird happened */
print("The new angle should return " + player.Angle)
}
else MessagePlayer("Wheres the car?", player, 255, 0, 0);
}
Maybe you could try setting the players angle instead to what you want it. If the vehicle angles to your desire save it with player.Angle. Should do the trick
function GetRadiansAngle(Rotation)
{
local angle;
angle = ::asin( Rotation.z ) * -2;
return Rotation.w < 0 ? 3.14159 - angle : 6.28319 - angle;
}
Source. (http://forum.vc-mp.org/?topic=1177.msg25175#msg25175)
Quote from: Mötley on Nov 26, 2016, 12:14 AM...
This crashes
Quote from: Xmair on Nov 26, 2016, 04:52 AMfunction GetRadiansAngle(Rotation)
{
local angle;
angle = ::asin( Rotation.z ) * -2;
return Rotation.w < 0 ? 3.14159 - angle : 6.28319 - angle;
}
Source. (http://forum.vc-mp.org/?topic=1177.msg25175#msg25175)
Still being the same.
Here's my code:
/setangle:
db.query("UPDATE vehicles SET rx="+player.Vehicle.EulerAngle.x+", ry="+player.Vehicle.EulerAngle.y+", rz="+GetRadiansAngle(player.Vehicle.Angle)+" WHERE id="+player.Vehicle.ID);
Message("Angle set to: "+player.Vehicle.EulerAngle);
Message("AngleZ radians: "+GetRadiansAngle(player.Vehicle.Angle));
LoadVehicles:
local rot = Vector(sqlite_column_data(query, 4), sqlite_column_data(query, 5), sqlite_column_data(query, 6));
vehicle.EulerAngle = rot;
Just use the function instead of rotation angle x,y,z.
local rot = Vector(sqlite_column_data(query, 4), sqlite_column_data(query, 5), sqlite_column_data(query, 6));
vehicle.EulerAngle = rot;
What?!
My code does not crash for me. I have been able to save vehicle angles.
For me, I just set the vehicle angle to be the players angle, Set the angle to my desire, Then save that vehicle,
I just use Vehicle.Angle when installing the cars.
Player.Angle for saving the car.
Not some Vector. But maybe there is supposed to be a different way idk..
Ankris, use like this:-
"Update h set angle="+player.Vehicle.GetRadiansAngle()
Then, use that angle instead of vector while creating the vehicle
OK I got it, vehicles starts from 1 instead of 0 and I was saving the wrong car.
Thank you to everyone who tried to help me c: