This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi, I'm trying to make a game on which you can push boxes to solve puzzles, is a 2D platformer basically, but I found a problem.

When a box (that is actually a kinematic body) is between two static bodies it gets stucked in the middle(No matters which function I use, is the same behaviour with moveandslide() and moveandcollide()).

I tried with a rigid body and it simply slides between the static bodies, totally different than the kinematic, and I would like to replicate that behaviour but using a Kinematic body.

For the type of game that it is, I need to use a kinematic body.

Any suggestions?


There are the steps to follow if you want to replicate it, I'm using the 3.0.6 stable release.

First of all create a project and add two static bodies they can be a 32x32 image, if you want you can stretch it in the Y axis to give a better effect, separate them exactly 32 pixels in the X axis, that is the space on where the kinematic body should move.

Then create a kinematic body with a 32x32 image, and a collisionShape2D (16x16) and put the kinematic body between the two static bodies, add a script to the kinematic body, one that only has in the process function moveandslide(Vector2(0, 50))


The final scene should looks like the next one:

Final scene

After all the process you will see the problem, but replace the kinematic body with a rigidbody and you will see how it slides between the static bodies.

And that's all, I hope somebody can help me.

in Engine by (47 points)
edited by

I edited your post because it's not possible to use links to Google Drive to display images (they are not direct links). It's also recommended to paste code as text rather than an image (so people can copy it easily to test).

About your question, I see you should be using _physics_process instead of _process. However, even when I fix that I can indeed reproduce the problem in Godot 3.0.6 and Godot 3.1 alpha 1, even with pixel snapping. The only way I could fix it was to reduce the extents of the box by a small amount.

I created a new issue:

Thanks for the answer, I will see what can I do while an official solution for this problem is created

Please log in or register to answer this question.

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.