One RigidBody slides into another and get stuck.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bleistift


I have created a physics simulation with one wall (StaticBody), two circles that are movable (RigidBodys, each one is connected to a “cursor” (KinematicBody without collision) through a generic 3dofjoint setted up as linear spring in X and Z direction) and one puck (RigidBody) that is just moved by physics.
Althrough it is 3d, the physics is 2d because the Y-Axis is locked for all nodes.

##What I have done:

I moved the two circles through the cursors so they presses the puck against the wall.

##What I would expect:

Because the circles are moved through cursers connected through springs, they stop moving if it is not possible because the puck is in the way and the springs expands.

##What happened instead:

The puck get moved into one of the circles and get stuck into it. I can move the circle around and if I am fast enough, the puck stops stucking and is thrown away.

What do I have to do to get the behavior that I would expect?

:bust_in_silhouette: Reply From: blockchan

I would guess that one node of your joint which is driven by KinematicBody ignores physics (its position is translated directly by cursor) which messes up second node.

I would set first body as RigidBody, too, and apply force following cursor, that way whole joint and puck will be driven fully by physics engine.

I have tested this approach. Now it mostly works as I would expect:
If the two circles are pressing the puck against the wall, they stop at the puck. If the pressure is to high, mostly, one of the circle is pressed away and the puck get shot in one direction.
But the problem is, that sometimes, the puck still merged into one of the circles.

bleistift | 2020-05-11 11:30

If the force is too high, physics engine will bug out and push objects through themselves. You can try checking continuous collision dectection (Continuous Cd) for your RigidBodies, maybe increasing physics engine framerate in projects settings (so it follows mouse movements more often) and reducing applied force when objects are colliding.

blockchan | 2020-05-11 12:23

To decrease the force, I have changed the mass of the elements to much smaller values. Now it is working. Thank you :slight_smile:

bleistift | 2020-05-13 08:02