

Note: Be careful to never scale your collision shapes in the editor. These nodes allow you to draw the shape directly in the editor workspace. The most common way to assign a shape is by adding a CollisionShape2D or CollisionPolygon2D as a child of the object. Note: In order to detect collisions, at least one Shape2D must be assigned to the object. These shapes are used to define the object’s collision bounds and to detect contact with other objects.

Collision shapesĪ physics body can hold any number of Shape2D objects as children. All movement must be implemented in code. See Godot 3.0: Rigid Bodies for more information.Ī body that provides collision detection, but no physics. You do not control a RigidBody2D directly, but instead you apply forces to it (gravity, impulses, etc.) and the physics engine calculates the resulting movement. This is the node that implements simulated 2D physics. This type of body is most often used for objects that are part of the environment or that do not need to have any dynamic behavior. It participates in collision detection, but does not move in response to the collision. Godot offers three kinds of physics bodies, grouped under the PhysicsBody2D type:Ī static body is one that is not moved by the physics engine. When a collision is detected, you typically want something to happen.

In game development you often need to know when two objects in the game space intersect or come into contact. In this tutorial, we’ll look at the KinematicBody2D node and show some examples of how it can be used. You can avoid problems and simplify development if you understand how each each works and what their pros and cons are. Trying to decide which one to use for your project can be confusing. Godot offers a number of collision objects to provide both collision detection and response. Godot 3.0: Using KinematicBody2D by Chris Bradfield Tue, Tags:
