Advertisement
djhonga2001

GTA 5 get coords In front of cam

Aug 10th, 2015
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Vector3 GetCoordsInfrontOfCam(float range)
  2. {
  3. Vector3 GameplayCamRot = CAM::GET_GAMEPLAY_CAM_ROT(2);
  4. Vector3 GameplayCamCoord = CAM::GET_GAMEPLAY_CAM_COORD();
  5.  
  6. float tan = (float)(cos(GameplayCamRot.x) * range);
  7. float xPlane = (float)((sin(GameplayCamRot.z * -1.0f) * tan) + GameplayCamCoord.x);
  8. float yPlane = (float)((cos(GameplayCamRot.z * -1.0f) * tan) + GameplayCamCoord.y);
  9. float zPlane = (float)((sin(GameplayCamRot.x) * range) + GameplayCamCoord.z);
  10.  
  11. return Vector3{ xPlane, yPlane, zPlane };
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement