Author Topic: How to Get Player/Camera Rotation (client-side)  (Read 659 times)

How do I get my player's/camera's rotation from the client-side?

I know how to get it on the server-side (%client.player.rotation). But I need to be able to get my orientation on any server. I tried exporting variables before and after rotating my player and checked the difference between the variable sets. However, the only related variable I could find was $cameraSpeed, and it doesn't really tell me anything.

try using object.getTransform()


the player
oops you meant clientsided
« Last Edit: June 06, 2017, 12:18:25 AM by Hawt »

from Script_Compass

Code: [Select]
%r=serverconnection.getcontrolobject().gettransform();
%rx = getword(%r, 0);
%ry = getword(%r, 1);
%r= 2 * $pi - (getword(%r,5) * getword(%r,6));
%rootcos=mcos(%r);
%rootsin=msin(%r);
%compassposx = getword(CompassH_IMG.position, 0) + (getword(CompassH_IMG.extent, 0) / 2);
%compassposy = getword(CompassH_IMG.position, 1) + (getword(CompassH_IMG.extent, 1) / 2);

only the top part is relevant

youll want to first do a check to make sure the player is in a server and if they are controlling a player

Code: [Select]
if(isObject(serverConnection))
{
     if(isObject(serverConnection.getControlObject()))
     {
            %pos = serverConnection.getControlObject().getTransform();
            //code
     }
}