Liberty Unleashed

Scripting => Script Tutorials => Topic started by: Shadow. on July 27, 2013, 01:15:54 am

Title: How to set a vehicle's angle correctly.
Post by: Shadow. on July 27, 2013, 01:15:54 am
If you didn't know, setting a vehicle's angle points to weird directions, well, here is your fix!
Instead of passing degrees, you must pass a radian.
I provided a simple DegreesToRadians function below:

Code: [Select]
function DegreesToRadians(deg)
{
local rad = deg * PI / 180.0;
return rad;
}

You will have to do
Code: [Select]
vehicle.Angle = DegreesToRadians(desiredangle);
Usage example:
Code: [Select]
vehicle.Angle = DegreesToRadians(180);
The above example will set 'vehicle' s angle to 180.
Title: Re: How to set a vehicle's angle correctly.
Post by: Vortrex on July 27, 2013, 04:05:09 am
Nice!

This will be very helpful.
Title: Re: How to set a vehicle's angle correctly.
Post by: NC on July 27, 2013, 02:38:04 pm
How is it possible that no one tried to set the vehicle angle before, when LU is available for almost 3 years?
Title: Re: How to set a vehicle's angle correctly.
Post by: Vortrex on July 27, 2013, 10:52:18 pm
How is it possible that no one tried to set the vehicle angle before, when LU is available for almost 3 years?
We have set the vehicle angle before but it would just turn it in some bizarre direction instead of the desired one.
Title: Re: How to set a vehicle's angle correctly.
Post by: NC on July 28, 2013, 12:09:35 pm
Vortex, that's even more weird... Why did no one report, that "setting angle doesn't work" then?
Title: Re: How to set a vehicle's angle correctly.
Post by: Vortrex on July 28, 2013, 07:28:02 pm
Somebody did already, but we didn't know there was a script side fix until Shadow introduced it.

http://forum.liberty-unleashed.co.uk/index.php/topic,1157.msg7356.html#msg7356 (http://forum.liberty-unleashed.co.uk/index.php/topic,1157.msg7356.html#msg7356)