Issue making a single physics object with different bounce values

I am using Godot 4.4.

Question

Probably a noob question, but I’ve search this, YouTube, Reddit, etc. and haven’t found a workable solution. The basic premise involves creating a drum object that can be moved/dropped in a 2D (physics) room. The top part of that should have a higher bounce setting, but the sides and frame should be lower. When moved, it should all move as one.

Various (and sometimes quite dated) solution suggestions have come up short.

  1. Two sibling RigidBody2D bodies (under a Node2D parent) with pin joints. A single pin joint allows for one/both bodies to spin no matter what settings I try. (e.g., angular limits, bias, disable collision and softness.) Multiple pin joints work much better; however there is still some movement whenever another object actually collides with the top of the drum.

  2. Single RigidBody2D - I understand there can only be one Physics Material Override per RigidBody2D; however I have tried several options for changing that using a perimeter Area2D/Collision on top to check for incoming collisions at which point I tried changing physics_material_override.bounce to a different value and even swapping between two different saved overrides. (self.physics_material_override = drum_frame_physics_material)

Is there something I am missing in the solutions above or is there a different approach I am not seeing? I just want a single physics object that moves/reacts as a single object but has different physics properties (in this case bounce) for different parts.

Thanks!!!

Just spitballing idea here but maybe removing collision with each other side may solve the ‘some movement’ issue. It can be done by the add_collision_exception_with() function.

Pretty good spitball! Initial trials seem to work. Will play around with more scenarios today. Thank you so much!

I spoke too soon. :frowning: While it appears to tighten things up a bit, a higher velocity object does still rotate the top component ever so briefly. Will continue to play and I very much appreciate the suggestion lastbender.

1 Like

I was also thinking another possible solution but it may be hard to implement.

I think you can get the collision datas. So maybe you can come up with a customized behaviour where top or bottom part has a collision, you disable the collision of the other part and then pass this collision to the parent RigidBody so the parent moves only. Which would result top and bottom to move as well.

But I’m not sure if this is easy to do.

I just thought of something easier to implement.

On each physics frame, check the position of top and bottom and arrange manually.

For example you can make the top part as the ‘master’ so after each collision that both top and bottom is moved, check the bottom part’s position and move it manually to adjust the position so that it always has delta position difference to the top part