RigidBody2D
Inherits: PhysicsBody2D < CollisionObject2D < Node2D < CanvasItem < Node < ObjectDescription
A 2D physics body that is moved by a physics simulation. RigidBody2D implements full 2D physics. It cannot be controlled directly; instead, you must apply forces to it (gravity, impulses, etc.).Properties
float
default:"1.0"
The body’s mass.
Vector2
default:"Vector2(0, 0)"
The body’s linear velocity in pixels per second.
float
default:"0.0"
The body’s rotational velocity in radians per second.
float
default:"1.0"
Multiplies the gravity applied to the body.
bool
default:"false"
If true, the body is frozen and forces are not applied.
Methods
apply_central_impulse
Vector2
The impulse vector to apply
apply_impulse
apply_force
apply_torque
Signals
body_entered(body: Node)
Emitted when a body enters into contact with this one.body_exited(body: Node)
Emitted when a body exits contact with this one.Example Usage
- GDScript
- C#