Table of Contents
Collision Objects, Layers and Masks discussion
All following classes inherit
- can detect when objects overlap and can emit signals when bodies enter or exit
- can override physics properties such as gravity or damping in a defined area.
- Participates in collision detection, but does not move in response to the collision
- Do not control a RigidBody2D directly, but instead you apply forces to it
- You can handle collisions by connecting callback functions to signals like
- A body that provides collision detection, but no physics.
- All movement and collision response must be implemented in code.
- There is no such thing as signals like
- Instead, you should use
move_and_collideand investigate its return value,
To define collision bounds, you can add any number of
CollisionPolygon2D as child nodes.
When changing sizing the collision shape, you should always use the size handles, not the Node2D scale handles. Scaling a shape can result in unexpected collision behavior.
You can define collision layers to categorize collision objects. To exploit collision layers, you should configure collision masks for each object.