Godot Version
Godot v4.2.1
Question
Short version: My player can pick up and throw objects (CharacterBody2D nodes), which have an Area2D with a collision box. This collision box specifically does not register when thrown into collision TileMap walls when near other collision TileMap walls, but I don’t understand why.
A breakdown:
-
Player can pick up objects. A picked up object has all collision turned off. It both has Collision2D for the CharacterBody2D itself and an Area2D with Collision2D to activate functions.
-
Player can throw it, which will position it to a Marker2D in front of the player and apply velocity. All collision is turned back on. Area2D collision will cause a “bonk” animation on hit.
-
Object is snapped to TileMap grid using a Marker2D in its center, covered up by the “bonk”.
-
Player holds the item while near a wall above it.
-
Throw takes place as normal, but Area2D’s Collision2D doesn’t register at all. Hits wall and stops only due to CharacterBody2D’s Collision2D.
This would probably be an acceptable “good enough” outcome, except for one thing: I would like to make the Area2D’s collision box smaller so it doesn’t get snagged when trying to throw it against objects or activate when throwing right next to a wall (sometimes happens when right/left of one). But if I do that, I have to make the CharacterBody2D’s collision box smaller too, and that means in this scenario, the box gets stuck partway into the wall.
There seems to be an obvious issue here: The object is close to the wall when doing the throw process, which would seem to suggest that’s disabling the Area2D collision somehow. But if I assumed it’s because the CharacterBody2D’s collision is hitting first, and I set it to not turn the CharacterBody2D’s collision back on after being thrown, the Area2D STILL doesn’t register and it just goes through the wall.
I COULD come up with a way to make it so the Marker2D for throw placement is lower relative to the wall you’re close to, but I am concerned that without knowing what is happening here, there could be future issues.
Why is Area2D’s CollisionShape2D not activating in this scenario?