Add Torque in Local Space

How can I add torque to an actor in local space in Blueprint?

I figured it out. I needed to use Transform Direction function to convert local space to world space.

Thanks for coming back with your answer. These forums are a bit bare on answers at the moment and any answer no matter how little might help someone.

do you mean convert world to local space ?

Would be nice to have an Add Relative Torque option ?

Do you have an example?

some code would be nice

Another potential solution:

I realized I had “use controller pitch / yaw / roll” set to “true” in the details section of my physics-driven pawn. Unchecking those options finally let my pawn rotate freely using AddTorque.

(This was after trying converting the coordinate space on my torque vectors between world and local without any luck.)

115234-rotationcontrols.png

for who still needs solution

For those still wondering about how the transform direction works in practice, here is an example of how to convert a global torque applied to a mesh into a local torque.

This example is rotating my teapot actor around the Z axis so you get a teapot spinning round on the flat floor. The torque being applied is in the Z axis only and its magnitude is stored in float variable Ztorque_Pos (Pos is short for positive not for position).

136664-add+torque+global+node.png

This second image is how you transform that torque so that it matches the orientation of the teapot. Then, the teapot will rotate correctly on an angled surface for instance.

Note that once transformed the torque vector will no longer have X and Y values equal to zero so you must feed all three x,y,z to the Add torque node.

The number 2 at the end of the names is not significant, I just made a second teapot with that name.

Time for a nice cup of tea I think.

2 Likes

Example posted below

Example posted below

Answer posted below

I think this may have changed now, I’ve found the node “get Relative Transform” does the job !

I’m not sure if its a new node but you can now call “Get Relative Transform” and specify the relevant object you want to check for it.

thanks man !