get camera angle?
#1

if player camera is facing the same way as player ? how to get
Reply
#2

GetPlayerFacingAngle(playerid, Angle);
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

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.
Reply
#7

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 :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)