0 votes

Hello! I hope you're having a nice day.

I'm making a small prototype build for a project idea I have in mind(I'm only 5 minutes in) and I have a shipping container(StaticBody2D), with a Rect CollisionShape2D and a sprite.

I have basic code to move a player(kinematicBody2D) around (screenshot attached), he has a circle CollisionShape2D. I have only coded movement, no collision code aside from "moveandslide".

It works mostly well, except that if I run into the container, I get stuck onto it, and I can only move along the side of it(as if it were a rail, and i was a curtain) and not away from it. I can only detach from the container by jiggling at the corner of the container.

Where is my error in my program that causes the shape to be stuck inside the other shape, unable to escape?

Kindest Regards.

https://imgur.com/a/G4CzfdO

Godot version 3.5.1
in Engine by (20 points)
edited by

I cannot say this for certain so I wont call this an answer just in case someone else has a better answer but have you tried lowering the speed of your player to say 100 and seeing if you get the same issue?

Hello! Yes, I tried lowering it to 100, and making it higher, both of the same problem. It also stuck to barrels and crates' collision shapes. Is this a .5 glitch?

I dont think so I am using 3.5 and I didnt have this issue but I did once have a sprite which was moving so fast that it glitched into some collision shapes so thats why I asked. Sorry i am not sure what else it might be.

Just a guess based on recently following Heartbeast's tutorial.
You are adding the return value from moveandslide() in position.
Shouldn't that be stored as the new velocity?
Check out this video at about 14:50

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.