appsinacup / godot-box2d

Godot Box2D – C++ Godot Extension that integrates the Box2D physics engine.
MIT License
317 stars 10 forks source link

PinJoint2D has an odd "self stabalizing" behavior. #104

Open SirLich opened 5 months ago

SirLich commented 5 months ago

Describe the bug When using a PinJoin2D to connect two Rigid Bodies, Box2D will "self stabilize" in a way that's inconsistent with Godot Physics.

To Reproduce Steps to reproduce the behavior:

  1. Download example project
  2. Press 'Play'. You can view the unicycle crash to the ground (Godot Physics)
  3. Change physics to Box2D (included in the project already)
  4. Press 'Play'. You can view the unicycle self-stabilize itself, and drive around the test area.

Box2D:

image

Godot:

image

Expected behavior While somewhat novel, I expect the Box2D PinJoin2D to function more similarly to Godot Physics.

Project uni.zip

Versions (please complete the following information):

SirLich commented 5 months ago

Note: I've tried Rapier, and it actually works!

Ughuuu commented 5 months ago

Interesting. I wonder if the angle limits are enabled even if the flag is off. I'll investigate and see.

SirLich commented 5 months ago

@Ughuuu setting the flat to True and then fiddling with the lower and upper angles doesn't appear to have any (or at least the desired) effect.

if I turn it on, and leave the angles at '0', it yeets itself into non-existance as soon as the wheel hits the ground.

SirLich commented 5 months ago

Turning the 'moter' on is fine, until the seat hits the ground, then it yeets itself as well.