CollisionShape2D Not Fuctioning

Godot Version



I’ve been working on a very simple base for an RPG game and I’ve come across a weird issue, I have a tree scene, and a player scene, both with a CollisionShape2D note attached and set up. The player’s movement is velocity based but for whatever reason, the player is able to just walk straight thorough the tree. Does anyone know how to fix this?

1 Like

There are many reasons this can happen. It’s difficult to see unless we see the setup of your nodes.

A good place to start debugging is checking if they’re on the correct layer and masks

My Player is a CharacterBody2D:

My Tree is an Area2D:

I have Y-Sorting Enabled and it functions properly, both sprites are on the same Z level and the same light/visibility layer. I don’t really know which of that matters but it’s all equal

Use a StaticBody2D node for your tree as although an Area2D node can detect when a body enters it, it will not prevent that body from doing so.

1 Like

This fixed the collision, but now the Y-Sorting is broken?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.