Angle of vehicles

Started by darlan, Mar 01, 2019, 04:19 AM

Previous topic - Next topic

darlan


I can not change the angle of the cars, everyone is heading north.

dracc

What does your current vehicle creation line look like?
Also, angle is probably supposed to be in Radians and not Degrees.

rww

#2
U can get correct vehicle angle by this script

function CVehicle::GetRadiansAngle() //by Gudio
{
local angle = ::asin(this.Rotation.z) * -2;
return this.Rotation.w < 0 ? 3.14159 - angle : 6.28319 - angle;
}

I never get problems with values from this code ;)

Example, how to get correct angle by /pos command

onPlayerCommands event:
local veh = player.Vehicle;

if (cmd == "pos")
{
if (!veh) ClientMessage("* Your Cords:[#ffffff] "+player.Pos.x+", "+player.Pos.y+", "+player.Pos.z+", "+player.Angle,player,128,255,0,255);
else ClientMessage("* Your Vehicle Cords:[#ffffff] "+player.Pos.x+", "+player.Pos.y+", "+player.Pos.z+", "+veh.GetRadiansAngle(),player,128,255,0,255);
ClientMessage("* Virtual World:[#ffffff] "+player.World+" [#80ff00]/ Sec World:[#ffffff] "+player.SecWorld+" [#80ff00]/ Unique World: [#ffffff]"+player.UniqueWorld,player,128,255,0,255);
}
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X