SA-MP Forums Archive
Rotations With Quaternion - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Rotations With Quaternion (/showthread.php?tid=362160)



Rotations With Quaternion - BlackAtom - 23.07.2012

This below is my PIECE OF CODE: is a car boost that I want to use...

pawn Code:
new Float:vx, Float:vy, Float:vz;
GetPlayerCameraFrontVector(playerid, vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
SetVehicleZAngle(GetPlayerVehicleID(playerid),GetVehicleRotationQuat(playerid,-1,vx,vy,vz));
I want to set the vehicle's z angle basing on the camera direction. I used the "GetVehicleRotationQuat" function, but there is the second argument "w" and I don't know that I must write in this argument -.-"...

PLEASE, HELP ME!!!


Re: Rotations With Quaternion - Mauzen - 23.07.2012

You can just use something like
pawn Code:
SetVehicleZAngle(GetPlayerVehicleID(playerid),atan2(vx, vy));
// or
SetVehicleZAngle(GetPlayerVehicleID(playerid),360.0 - atan2(vx, vy));