Rotations With Quaternion
#1

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!!!
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)