In game development, you often need to know when two objects in the game space intersect or come into contact. This is known as collision detection. When a collision is detected, you typically want something to happen. This is known as collision response.
Godot offers three kinds of physics bodies, grouped under the PhysicsBody2D object type:
- StaticBody2D: A static body is one that is not moved by the physics engine. It participates in collision detection, but does not move in response to the collision. This type of body is most often used for objects that are part of the environment or do not need to have any dynamic behavior, such as walls or the ground.
- RigidBody2D: This is the physics body in Godot that provides simulated physics. This means that you don't control a RigidBody2D directly. Instead, you apply forces to it (gravity, impulses, and so...