Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pile of RigidBody2Ds results in overlapping and shaking #2092

Closed
Tracked by #45334
romulox-x opened this issue Jun 15, 2015 · 26 comments · Fixed by #55602
Closed
Tracked by #45334

Pile of RigidBody2Ds results in overlapping and shaking #2092

romulox-x opened this issue Jun 15, 2015 · 26 comments · Fixed by #55602

Comments

@romulox-x
Copy link
Contributor

Dump a bunch of rigibody2d's with rectangle collision shapes into a pit so they pile on top of each other, and the ones at the bottom are forced into each other. They overlap significantly, and constantly shake around as they try to resolve their colliisions.

Example:
https://copy.com/YWldXOFC18N1oYRk

@guilhermefelipecgs
Copy link
Contributor

One way to solve this is change fixed_fps of 60 for 180, with this value looks good for me.
I don't know if the option "Continuous Cd" (I think this should be Continuous Collision Detection) works. I never saw any difference with this option.

@akien-mga
Copy link
Member

Lol, that's hypnotizing :D
I can confirm that the bug is still reproducible using the minimal example included above in the current master branch.

@vnen
Copy link
Member

vnen commented Nov 22, 2015

There's a video showing this bug: https://www.youtube.com/watch?v=LYy3NTBElO4

@reduz
Copy link
Member

reduz commented Jan 3, 2016

Will fix this in 2.1, as I will probably switch to a less beautiful but more useful contact point generation code.

@reduz reduz added this to the 2.1 milestone Jan 3, 2016
@reduz
Copy link
Member

reduz commented Jul 9, 2016

i think i fixed this bug a few weeks ago, but i can't download the test case

@guilhermefelipecgs
Copy link
Contributor

New test case: test_rigidbody.tar.gz

I tested it with v2.0.4.1.stable and isn't working.

@akien-mga
Copy link
Member

I can still reproduce the bug in 2.1-beta using the above test case.

@akien-mga
Copy link
Member

I guess #515 might be a duplicate of this bug (or the other way around, as you prefer ;)).

@akien-mga
Copy link
Member

Not critical for the upcoming 2.1, so moving to the next milestone.

@akien-mga akien-mga modified the milestones: 2.2, 2.1 Jul 27, 2016
@daniell1988
Copy link

Just tested @guilhermefelipecgs' test case on master branch and this bug still occurs.

@akien-mga
Copy link
Member

What's the status of this bug in the current master branch?

@guilhermefelipecgs
Copy link
Contributor

guilhermefelipecgs commented Jul 5, 2017

Still happens.
Tested with this commit 6f63a01
Test project updated for version 3.0 test_rigidbody.zip

@reduz
Copy link
Member

reduz commented Jul 5, 2017

Hmm. I was convinced that this was fixed eventually.
Will have to leave for 3.1, as the plan there is to rewrite much of the 2D and 3D physics engines.

@vnen vnen added this to the 3.1 milestone Jan 22, 2018
@reduz
Copy link
Member

reduz commented Jul 29, 2018

Unfortunately leaving it for 3.2, Did not manage to find time to make the many changes to the 2D engine I desired.

@Anutrix
Copy link
Contributor

Anutrix commented Sep 7, 2019

Anyone working on this?
It's still reproducible in current master 4ee8ecd.

@capnm
Copy link
Contributor

capnm commented Sep 7, 2019

Anyone working on this?
It's still reproducible in current master 4ee8ecd.

Nop, I'm sure that would have made a big entry in the Godot Breaking News
But at least the RB implementation is not completely broken. Chris has found and documented a simple workaround for kinematic → rigid body interaction:
http://kidscancode.org/godot_recipes/physics/kinematic_to_rigidbody/

@vonedo3011
Copy link

Any news on this? It's rather important issue.

@Calinou
Copy link
Member

Calinou commented Feb 5, 2020

@vonedo3011 As far as I know, nobody is currently working on this. reduz might take a look at it for 4.0 if time allows.

@evah5
Copy link

evah5 commented Mar 17, 2020

How's the progress on this?

@Calinou
Copy link
Member

Calinou commented Mar 17, 2020

@evah5 Same as before, I haven't seen anyone work on this lately.

@btzr-io
Copy link

btzr-io commented Apr 24, 2020

I found an interesting bug, its probably related to one of this issues mentioned, here is the minimal reproducible example:
https://drive.google.com/file/d/1RhAzoUwNByq3OjqMgxq9xYNBAtxDnP6z/view?usp=sharing

I tried to increase the fps as suggested here but this only work once or twice, after that the rigid bodies on my scene start to overlap and shake again if you keep pressing the space bar.

@btzr-io
Copy link

btzr-io commented Apr 24, 2020

I'm still not sure if this is a bug or I'm doing something wrong...

From discord:

https://discordapp.com/channels/212250894228652034/342056330523049988/703046144208666714

@ btzr Today at 7:54 PM
Is there a safe way to disable and enable a collision shape and change the RigidBody2D mode from character to rigid at the same time ? I end up with this bug where they are overlapping and shaking...

Basically my character has two states:

  • `State A: RigidBody2D mode is set to CHARACTER and the circle collision shape is active.
  • State B: RigidBody2D mode is set to RIGID and the circle collision shape is disabled.
func change_mode(new_mode):
    match new_mode:
        STATE_MODES.OBJECT:
            state_mode = STATE_MODES.OBJECT
            set_deferred("mode",  RigidBody2D.MODE_RIGID)
            $motion_collider.set_deferred("disabled", true)
        STATE_MODES.CHARACTER:
            state_mode = STATE_MODES.CHARACTER
            set_deferred("mode", RigidBody2D.MODE_CHARACTER)
            $motion_collider.set_deferred("disabled", false)
func _integrate_forces(state):    
    if Input.is_action_just_pressed("ui_select"):
        change_mode(STATE_MODES.OBJECT)
    if Input.is_action_just_released("ui_select"):
        change_mode(STATE_MODES.CHARACTER)

Its more easy to see than explain it, so I recorded the glitch / bug:
https://discordapp.com/channels/212250894228652034/610347507222052867/702744596421148733

@Calinou Calinou changed the title pile of rigidbody2d's = lots of ugly intersections Pile of RigidBody2Ds results in overlapping and shaking Aug 22, 2020
@Feniks-Gaming
Copy link
Contributor

@pouleyKetchoupp any chance of fixing this bug as you work on physics engine?

@pouleyKetchoupp
Copy link
Contributor

@Feniks-Gaming It's on my list, but I don't know how involved this is going to be so I can't promise anything yet.

@e344fde6bf
Copy link
Contributor

Maybe related to #29639. The depenetration algorithm doesn't seem to conserve energy when an object collides with more than one other object on the same frame. So in this case, the boxes can continuously gain energy preventing them from falling asleep.

@Calinou
Copy link
Member

Calinou commented Jun 8, 2021

I've done some testing with various physics FPS here: #49426 (comment)

This may help you choose a physics FPS value when trying to work around this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.