Collision Environment Issues

Godot Version

4.6.stable

Question

So I have a submarine pvp game and the submarines will not collide with the environment. I made sure the collision layers are all the same, but I think the issue lies with the characterbody 2d not having a collision shape. I didnt/dont think it would because I have children to the node that have rigidbody and collisionshapes set up properly. I also tried to manually give a collision shape to the original character body 2d, and that didnt fix anything. Heres the tree for the submarine:


And here is how i have the environment set up (very basic sorry)

A body will only accept a collision shape when it’s a direct child. So all your bodies should have at least one child node of type CollisionShape2D or CollisionPolygon2D with a defined shape.

Also your doors and other objects should probably be AnimatableBody2D’s. Rigid bodies in general are meant to apply physics on their own while they’re independent of any other nodes in the tree.

2 Likes

is there a limit to how many collision shapes a node can have? I tried putting one on for the ceiling and floor, but it still didnt collide

I don’t think so. Every collision shape sibling should work additively to the parent. It could be that the fact that they’re children of a ColorRect messes with the physics. Try changing it to a Node2D. Or maybe you’ve messed something else up, like layers or masks, or you turned off their process mode.

1 Like

thank you for your help ill let you know if i can fix anything

on the bright side it collides now but it just sinks instead of responding to velocity commands? It does slide me in the direction it should be going