Calculate required rotation for object to face in camera direction
#1

I am trying to make a minigun object attached to a maverick follow wherever the pilot's camera is facing. I've tried using GetPlayerCameraVector, GetPlayerCamera, etc.. But I cannot figure out how to calculate the required xrot,yrot,and zrot to face wherever the camera is facing (like rhino and hose on firetruck).

Does anybody have any idea how to do this? Thanks.
Reply
#2

GetPlayerFacingAngle?
https://sampwiki.blast.hk/wiki/GetPlayerFacingAngle
And:
https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector
Reply
#3

GetPlayerFacingAngle does not return the CAMERA.. And GetPlayerCameraFrontVector returns values that I need to calculate somehow, but I do not know how.. which I am trying to find out.
Reply
#4

Have you tried using "SetPlayerHoldingObject" and offsetting the object to the position you want? Not the answer to your question, but maybe a solution to your problem.

Note: The "SetPlayerHoldingObject" functions name has changed in 0.3c.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)