Detecting where the object is looking at - 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: Detecting where the object is looking at (
/showthread.php?tid=552565)
Detecting where the object is looking at -
SilentSoul - 25.12.2014
Hello, i am trying to create a dynamic canon system, it rotates with your screen movement by using
GetPlayerCameraFrontVector and
SetDynamicObjectRot and i am using a timer to update it, it works pretty fine, but my problem now how to detect where the object is looking at to create explosions or missiles.
EDIT:
Fixed, i have the calculated the player camera postion with camera front vector together, then i multiplied them by the distance i wanted. it works fine.
pawn Код:
new
Float:x,Float:y,Float:z,
Float:x2,Float:y2,Float:z2;
GetPlayerCameraPos(playerid, x,y,z);
GetPlayerCameraFrontVector(playerid, x2,y2,z2);
CreateExplosion(x+x2*20, y+y2*20, z+z2*20, 3, 5.0);//note *20 is the distance