Saturday, May 4, 2024
HomeGame Development2d - What exerts a force on my rigidbody?

2d – What exerts a force on my rigidbody?


I’m trying to create a simple 2D scene with two rigidbodies, which are connected by two pin joints.

There is one large rigidbody, a green circle, which is slowly rotating at a constant speed (as its StandardTorque is set to a value > 0) and has a large mass (100).

The other rigidbody is a red rectangle with mass 1. It should have no forces or movement of its own, as I set its AngularVelocity, ConstantTorque, StandardTorque, LinearVelocity, and ConstantForce properties to 0 or Vector2.Zero, respectively, at the moment where I connect the pin joints.

Default gravity in the project settings is set to 0 with a gravity vector of (0; 0).


My expectation is that the green circle keeps rotating slowly, always at the same speed, dragging the red rectangle around it in circles without any anomalies.

Unfortunately, most of the time, I observe the following effects very clearly as soon as the two objects are connected:

  • The green circle very visibly varies its rotation speed, becoming a lot faster when the red rectangle reaches a certain part of the circle (a different one each time the two bodies connect, but then the same place at each revolution), then slowing down again.
  • The red rectangle periodically starts to “wobble” – the wobbling becomes stronger, then goes down again -, sometimes to the point that it temporarily inverses the rotation direction of the green circle.

I have recorded a video of the behavior:

screen capture

Note that the very moment the two bodies connect, the two pin joints are fixed (that is, the NodePath is assigned on their NodeB property), the aforementioned properties are set to zero, and no other force is applied to any of the objects programmatically.

How can I find out what causes this behavior?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments