[SOLVED] Applying Torque From Point Other Than Center Of Mass

Hello everybody,

I would like to apply torque to a rigidbody from a point other than it’s center of mass. For example, if a body’s position is (1, 1, 1), then by default torque will be applied from the same point. What I would like to do is apply torque from a different point, say (0, 0, 0). Any way to do this?

I don’t think this is doable since the underlying physics engine (Ammo.js) doesn’t seem to support, in the same manner you can do it when applying a force:

And I think it makes sense since a rotational force makes sense to be applied to center/origin point of the body.

1 Like

So @Leonidas is there a workaround for this? My game won’t be able to function without this…

Not sure, what are you trying to achieve?

https://playcanvas.com/editor/scene/870258

Take a look at this👆. Use arrow keys to turn the object. If I make the circles on the end point upwards, the images don’t fall on it, but the bigger circle below it. I suspect this is because the object have moved, but the collision shapes haven’t. Or is it something else?

There are several issues with this project:

  • All of the SpinningCenter bodies are set to Static, this won’t work if you are moving the objects.
  • You are moving the objects using entity translation methods (rotateLocal) instead of applying forces/torques to the rigid bodies.

Try updating the project to fix this and you will be in a better shape. If it still doesnt’ work try posting again, here.

I don’t know why this is there, I told my dev to use torque.

I don’t want the objects to respond to gravity. How would I do it then?

Once I know the answer to this, I can fix it.

Then use Kinematic objects, this will do the trick for you, take a look at the manual towards the bottom there is a good explanation on how they work:

https://developer.playcanvas.com/en/user-manual/physics/physics-basics/

3 Likes

Ok, thanks. Will try this out tomorrow, and get back with the result.

1 Like

I forked the project and did what you asked me to. Works great. Marking as solved.

1 Like