RigidBody affects others even when they don't collide

chrisbarechrisbare Posts: 3Member
in 3D

I'm trying to understand RigidBody's. I've created a few and set their collision shape and margin.
They all start out sleeping, but when I wake up one, they all wake up if they are close to each other, but not actually touching.

In the pic you can see the 3 collision shapes don't overlap and in the CollisionShape panel you can see Margin is 0.001.
That tiny dark read dot is 0.01, so it's 10x the margin. Yet when I wake up one, they all fall.
If I move them further apart, the others aren't affected.
Is there another margin or something else involved here?
I'm trying to make a brick wall where you can remove the bricks one at a time to find a treasure behind, but if they are close enough together to look right, they all wake up when one gets touched and fall apart.

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 2,873Admin

    Welcome to the forums @chrisbare!

    It is probably because the physics objects are close enough together that Godot wakes all three of them automatically since they are likely to collide with each other given their distance, and from a performance perspective, it is easier to wake all of them at once than wake each individually when there is a collision.
    I would try changing the cell_size in the project settings to something smaller than 128 and see if that fixes it. I don't know if that will help or not, but it might, though smaller cell sizes means physics may take longer to execute, leading to less performance.

    If you are okay with a script solution, then you could try something like this on the RigidBody2D nodes:

    extends RigidBody2D
    var force_sleep = true
    func _physics_process(_delta):
        if force_sleep:
            sleeping = force_sleep
    

    Then in the script for moving the RigidBody2D nodes, you just need to do something like:

    if "force_sleep" in selected_rigidbody_node:
        selected_rigidbody_node.force_sleep = false
        selected_rigidbody_node.sleeping = false
    

    And then it should fall like normal, but the other RigidBody2D nodes should hopefully stay asleep and in position.

    Also:


    This discussion was caught in the moderation queue since you have not confirmed your account yet.

    Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.

    If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:

  • chrisbarechrisbare Posts: 3Member

    I looked at cell_size but it is only under Physics2D. I'm using 3D.
    I tried switching the engine from Bullet to GodotPhysics and that make it work as expected. I'm not sure if that will cause any other issues.

  • TwistedTwiglegTwistedTwigleg Posts: 2,873Admin

    Ah, my bad! I assumed it was 2D because of the picture, but I should have noticed there were spatial-based nodes :sweat_smile:

    Hmm, might be worth reporting to the Godot GitHub repository, assuming it does not exist, since the issue does not occur with Godot physics but does occur with Bullet. This means one of the two implementations has a bug, and I'm thinking it may be the Bullet physics rather than the GodotPhysics.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file