Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
So I wanted to make the SAM sites work at Area 69, and I want the rocket to face the player on ALL axis. Could someone give me a function for this? I'm totally useless with maths.
Cheers.
Posts: 2,938
Threads: 162
Joined: May 2010
all axis?
do you know this means calculating x, y and z angle?
players and vehicles don't have x and y angle, only z angle. Unless you can work with GetVehicleRotationQuat.
pawn Код:
stock Float:Angle2D(Float:PointAx, Float:PointAy, Float:PointBx, Float:PointBy)
{
new Float:Angle;
Angle = -atan2(PointBx - PointAx, PointBy - PointAy);
return Angle;
}
SetObjectRotation( playerid, x, y, Angle2D( objectx, objecty, attackingx, attackingy ));
That's for Z angle, good luck.
Try searching for quat to eular functions
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
I never said vehicles/players have an x/y angle. I want to set an OBJECT'S rx ry rz angles to face a set of COORDINATES, i.e. a PLAYER. I want to make the rocket object face the target player.
Posts: 2,938
Threads: 162
Joined: May 2010
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
RyDeR`s function works great, thank you very much.