0 votes

I've been having problems with my enemy's collision box (it needs one because it's a KinematicBody).
I want it so that the player will just pass straight through it when he's at the top of the enemy. Though the problem is that he will just stay on the enemy, like a moving platform.
It was probably because it's a rectangle, so I tried to change it to a RayShape2D. Though, the player just glitches when he reaches the enemy.
The player's collision shape is Rectangle2D.
I thought of using one way collision, though the problem is that it only detects top and bottom. Is there any way to fix the enemy collision shape so the player can pass through it when he's at the top?

asked Jun 10 in Engine by owlisGODOT (29 points)

it needs one [collision box] because it's a KinematicBody

A KinematicBody does not need an attached CollisionShape. It just won't be able to collide with anything without one. Other than that it will work just fine.

tried to change [the player's collision shape] to a RayShape2D. Though, the player just glitches when he reaches the enemy.

What do you mean by "just glitches"? What exactly is happening?

Without knowing more about your game and what you're trying to achieve, it's hard to give you the answer you're looking for. You could replace the CollisionShape2D attached to your player with three RayCast2D-nodes pointing up, left and right of it. If one of them collides with an enemy, you'd stop the movement. As there's no ray pointing downwards, the player would still be able to fall through enemies though.

The game is a platformer. I've tried what you said, but the player just phases through the platforms and disappears.
The "glitch" is that the enemy just walks over the player, and the player loses his ability to jump.

I just fixed it! I just had to use collision layers...

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 How to use this Q&A? before posting your first questions.