Community Forum

Change z-Rotation of player-camera

Forum Overview >> Scripting

CategoryScripting
Created07.03.2016 20:44


Silas R. (Silas770) 07.03.2016 20:51
Hi,
is it possible to change the z-rotation of the onFoot/player-camera?

I just tried to get the id of the camera from "g_currentMission.player.cameraId" and get the rotation with "getRotation". But when I print out the values, y and z are always 0 and they can't be changed with "setRotation".

Is there a possible way to change the z-rotation?


Thanks,
Silas770

Emil Drefers (Unknown) 08.03.2016 07:46
Hi,

wondering why you want to do that?

You could append a function to the Player:update(dt) trying to adjust the rotation values.
But it might get tricky ;)

Cheers,
Emil



Silas R. (Silas770) 11.03.2016 16:43
I want to do that, because a user asked me to write a script for rotating the camera on the z-axis to make diagonal screenshots and video recordings.

How can I append such a function to the Player:update(dt)?

Emil Drefers (Unknown) 14.03.2016 07:00
Hi,

in your new script you could try something like:

a)
MyMod.update = Utils.appendedFunction(Player.update, MyMod.udpate);
function MyMod:udpate(dt)
end

or b)
originalUpdateTick = Player.updateTick(dt);
function Player:updateTIck(dt)
originalUpdateTick(self, dt);

-- update z rotation
end

Cheers,
Emil


Silas R. (Silas770) 14.03.2016 19:14
Ah, it works.

Big thanks to you.


Note: Log in to post. Create a new account here.