get camera angle? - 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: get camera angle? (
/showthread.php?tid=414909)
get camera angle? -
mastermax7777 - 10.02.2013
if player camera is facing the same way as player ? how to get
Re: get camera angle? -
Joshman543 - 10.02.2013
GetPlayerFacingAngle(playerid, Angle);
Re: get camera angle? -
mastermax7777 - 11.02.2013
No, i want to check if player is looking infront of him, not behind ..
aka if getXY inFront of Player == CameraLookAt or something like that
Re: get camera angle? -
Backwardsman97 - 11.02.2013
Look at GetPlayerCameraFrontVector.
https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector They also provide examples. It may or may not be what you're looking for, depending on what you're trying to accomplish.
Re: get camera angle? -
mastermax7777 - 11.02.2013
yes, but how about i might go and do this? i have been trying to play with this using this function, atan .. but im not getting the thing i wanted :/
i need to see if player is looking in front (seeing the backside ) or back,.. Like when head rotates.. lol
Re: get camera angle? -
MP2 - 11.02.2013
pawn Код:
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
{
new Float:TGTDistance;
// get distance from camera to target
TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
new Float:tmpX, Float:tmpY, Float:tmpZ;
tmpX = FrX * TGTDistance + CamX;
tmpY = FrY * TGTDistance + CamY;
tmpZ = FrZ * TGTDistance + CamZ;
return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
pawn Код:
new
Float:camPos[3],
Float:camVector[3];
GetPlayerCameraPos(playerid, camPos[0], camPos[1], camPos[2]);
GetPlayerCameraFrontVector(playerid, camVector[0], camVector[1], camVector[2]);
DistanceCameraTargetToLocation(camPos[0], camPos[1], camPos[2], x, y, z, camVector[0], camVector[1], camVector[2]);
Pretty self-explanatory.
Re: get camera angle? -
mastermax7777 - 11.02.2013
this is not what i want, i just wanted to check if player is looking (camera) in front of himself, or behind (-facingAngle).. do u understand?
i think this is basic trig.. but im not too very good wit it :/