The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote


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?

in Engine by (16 points)

1 Answer

+1 vote

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.

by (113 points)
edited by

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.