Community Forum

set WorldRotation of a collision to a transformGroup

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created21.02.2010 12:28


Benjamin G (unknown) 21.02.2010 12:30
Hello
I have a problem.
I would like to set the WorldRotaion of a Collision to a TransformGroup on a other Vehicle.
I hope any body can help me.

I hope you understand me ;-)
mfg. Geri-g


Stefan Geiger - GIANTS Software 22.02.2010 10:08
There is no setWorldRotation function. However there is a setDirection function which is quite handy for this task.

You should get the z and y direction of the object you want to take the rotation of, transform these to world space and then transform these vectors to the space of the parent of the object you want to rotate.
To do this you can use the localDirectionToWorld and worldDirectionToLocal functions.

If the source object is srcId and the destionation node is destId you could use something like this:
local zX, zY, zZ = localDirectionToWorld(srcId, 0,0,1);
local zX, zY, zZ = worldDirectionToLocal(getParent(destId), zX, zY, zZ);

local yX, yY, yZ = localDirectionToWorld(srcId, 0,1,0);
local yX, yY, yZ = worldDirectionToLocal(getParent(destId), yX, yY, yZ);

setDirection(destId, zX, zY, zZ, yX, yY, yZ);


Benjamin G (unknown) 22.02.2010 12:08
Hi Stefan,

thank you very much, it works perfect ;-)


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