Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Rigidbody connected with a Pinjoint accelerates for no reason #98

Open
Pyrocreep opened this issue Jan 10, 2024 · 4 comments
Open

Rigidbody connected with a Pinjoint accelerates for no reason #98

Pyrocreep opened this issue Jan 10, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Pyrocreep
Copy link

Describe the bug
Rigidbody seems to keep gaining momentum when attached to a staticbody using a pinjoint

To Reproduce
Steps to reproduce the behavior:

  1. Make a static body
  2. Make a rigidbody
  3. Attach them using a pinjoint

Project
https://drive.google.com/drive/folders/1HsmJvfHw9jBL3yek3hZRsB3BhkWgjW4X?usp=sharing

Versions (please complete the following information):

  • OS: Windows
  • Godot 4.2
  • Box2d 2.4.1
@Pyrocreep Pyrocreep added the bug Something isn't working label Jan 10, 2024
@Az-qianchen
Copy link

2024-01-11.201449.mp4

I just moved the CollisionShape2D

@Pyrocreep
Copy link
Author

2024-01-11.201449.mp4
I just moved the CollisionShape2D

yeah, ive had this issue too but thought it was my code or something lol

@Ughuuu
Copy link
Collaborator

Ughuuu commented Jan 11, 2024

Right, I think the issue is related to the center of mass. Since you move the shape, but the anchor remains the same, the object has a very weird inertia. So this is the default behaviour of box2d in this case. From what I saw box2d doesn't like objects like this that don't have shape in center or close to center.

What is the use case of this though? Why can't you move the rigidbody instead?

If you think about it from a physical point of view, it's kind of weird if the shape isn't centered to zero on the body.

@Ethanol54006
Copy link

Right, I think the issue is related to the center of mass. Since you move the shape, but the anchor remains the same, the object has a very weird inertia. So this is the default behaviour of box2d in this case. From what I saw box2d doesn't like objects like this that don't have shape in center or close to center.

What is the use case of this though? Why can't you move the rigidbody instead?

If you think about it from a physical point of view, it's kind of weird if the shape isn't centered to zero on the body.

i just enciutered an issue in my pinball game, where the paddles(on a pinjoint) worked fine, then i scaled them down(by remaking the sprite and remaking the collision shape) lined it up in the exact same way, and all of a sudden it didnt work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants