0 votes

Introduction

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?

asked May 8 in Engine by bleistift (14 points)

1 Answer

0 votes

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.

answered May 8 by blockchan (90 points)
edited May 8 by blockchan

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.

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.

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.