Community Forum

Determine Vehicle angle

Forum Overview >> Scripting

CategoryScripting
Created11.12.2021 09:37


Dirk Hameier (DirkH42) 11.12.2021 09:37
Hello,
I need help to determine the current angle of a vehicle, as I would like to automatically orient the exterior camera relative to the vehicle. For example, when the vehicle is driving up or down a hill.
Thanks
Dirk

Bilbo Beutlin (BBeutlin) 11.12.2021 10:53
You need the rootNode of the vehicle, eg. by 'g_currentMission.controlledVehicle.rootNode'.
Then you get the world or local translations and rotations with the usual functions (see LUADOC/engine/scenegraph), eg.
local rx, ry, rz = getWorldRotation(vehicleRootNode)
Note that angles are in radians, not degrees.

Andrej Mazak (eLvisSK) 30.01.2023 16:45
i deleted my original post cause i solved problem


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