To apply torque off center
Asked Answered
C

2

0

I tried building a sort of active ragdoll, but realized there is no way in the engine to apply torque off objects origin, at a pin joint for example.
If I only needed one point of rotation I could place origin at the pin, but for a ragdoll a body may be connected with two (or more) joints. If I want those joints to be powered and act correctly I need a way to apply torque at their position. Is there any recipes|examples on how to apply torque to a rigid body at arbitrary point?

Cispadane answered 1/6, 2023 at 16:47 Comment(0)
G
0

So torque is going to rotate around the center of mass, it doesn't really make sense for it to be at another point.

However, you can apply an impulse, which at the right position would cause a rotation.

https://docs.godotengine.org/en/3.5/classes/class_rigidbody2d.html?highlight=rigidbody2d#class-rigidbody2d-method-apply-impulse

Gober answered 1/6, 2023 at 17:21 Comment(0)
C
0

Gober Are there examples around of how to calculate the impulse from a given torque? I tried looking but found nothing useful.
Edit: Actually, it looks like the apply_impulse alters the linear velocity disregarding the point the impulse is applied at, which I think is incorrect. I might need to calculate linear and angular acceleration directly instead.

Cispadane answered 2/6, 2023 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.