reckfellENGINE

RigidBody2D

A 2D dynamic body driven by forces and contacts.

On this page
class RigidBody2DReckfellSharpInherits PhysicsBody2D

RigidBody2D receives motion from the physics integrator. Use forces for thrust and impulses for one-off pushes. Repeated Position/Rotation writes in _Process compete with simulation. Request a controlled reset through _IntegrateForces and modify PhysicsDirectBodyState.

BodyEntered requires ContactMonitor and a positive MaxContactsReported. Sleeping, Freeze and shape Disabled differ. CustomIntegrator disables ordinary force integration, not every contact. The example checks falling, impulse, reset and freeze, not every stack/speed/platform.

Guide and example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

RigidBody2DConstructor
# RigidBody2D
C#
public RigidBody2D();

Properties23

AngularDampProperty
# AngularDamp
C#
public float AngularDamp { get; set; }

Damps the body's rotation. By default, the body will use the ProjectSettings.physics/2d/default_angular_damp setting or any value override set by an Area2D the body is in. Depending on RigidBody2D.AngularDampMode, you can set RigidBody2D.AngularDamp to be added to or to replace the body's damping value. See ProjectSettings.physics/2d/default_angular_damp for more details about damping.

AngularDampModeProperty
# AngularDampMode
C#
public RigidBody2D.DampMode AngularDampMode { get; set; }

Defines how RigidBody2D.AngularDamp is applied.

AngularVelocityProperty
# AngularVelocity
C#
public float AngularVelocity { get; set; }

The body's rotational velocity in radians per second.

CanSleepProperty
# CanSleep
C#
public bool CanSleep { get; set; }

If true, the body can enter sleep mode when there is no movement. See RigidBody2D.Sleeping.

CenterOfMassProperty
# CenterOfMass
C#
public Vector2 CenterOfMass { get; set; }

The body's custom center of mass, relative to the body's origin position, when RigidBody2D.CenterOfMassMode is set to RigidBody2D.CenterOfMassModeEnum.Custom. This is the balanced point of the body, where applied forces only cause linear acceleration. Applying forces outside of the center of mass causes angular acceleration. When RigidBody2D.CenterOfMassMode is set to RigidBody2D.CenterOfMassModeEnum.Auto (default value), the center of mass is automatically determined, but this does not update the value of RigidBody2D.CenterOfMass.

CenterOfMassModeProperty
# CenterOfMassMode
C#
public RigidBody2D.CenterOfMassModeEnum CenterOfMassMode { get; set; }

Defines the way the body's center of mass is set.

ConstantForceProperty
# ConstantForce
C#
public Vector2 ConstantForce { get; set; }

The body's total constant positional forces applied during each physics update. See RigidBody2D.AddConstantForce and RigidBody2D.AddConstantCentralForce.

ConstantTorqueProperty
# ConstantTorque
C#
public float ConstantTorque { get; set; }

The body's total constant rotational forces applied during each physics update. See RigidBody2D.AddConstantTorque.

ContactMonitorProperty
# ContactMonitor
C#
public bool ContactMonitor { get; set; }

Enables body contact monitoring. Signals also need MaxContactsReported > 0 and actual contact between suitable shapes, not arbitrary visual overlap.

ContinuousCdProperty
# ContinuousCd
C#
public RigidBody2D.CcdMode ContinuousCd { get; set; }

Continuous collision detection mode. Continuous collision detection tries to predict where a moving body will collide instead of moving it and correcting its movement after collision. Continuous collision detection is slower, but more precise and misses fewer collisions with small, fast-moving objects. Raycasting and shapecasting methods are available.

CustomIntegratorProperty
# CustomIntegrator
C#
public bool CustomIntegrator { get; set; }

If true, the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the RigidBody2D._IntegrateForces method, if that virtual method is overridden. Setting this property will call the method PhysicsServer2D.BodySetOmitForceIntegration internally.

FreezeProperty
# Freeze
C#
public bool Freeze { get; set; }

Switches the body from ordinary dynamic simulation to the mode selected by FreezeMode. The executed frozen body did not move after an impulse. Does not promise to clear stored velocity or reset position.

FreezeModeProperty
# FreezeMode
C#
public RigidBody2D.FreezeModeEnum FreezeMode { get; set; }

The body's freeze mode. Determines the body's behavior when RigidBody2D.Freeze is true. Note: For a body that is always frozen, use StaticBody2D or AnimatableBody2D instead.

GravityScaleProperty
# GravityScale
C#
public float GravityScale { get; set; }

Multiplies the gravity applied to the body. The body's gravity is calculated from the ProjectSettings.physics/2d/default_gravity project setting and/or any additional gravity vector applied by Area2Ds.

InertiaProperty
# Inertia
C#
public float Inertia { get; set; }

The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value. If set to 0, inertia is automatically computed (default value). Note: This value does not change when inertia is automatically computed. Use PhysicsServer2D to get the computed inertia.

C#
private RigidBody2D _ball;

public override void _Ready()
{
    _ball = GetEntity<RigidBody2D>("Ball");
}

private float GetBallInertia()
{
    return 1.0f / PhysicsServer2D.BodyGetDirectState(_ball.GetRid()).InverseInertia;
}
LinearDampProperty
# LinearDamp
C#
public float LinearDamp { get; set; }

Damps the body's movement. By default, the body will use the ProjectSettings.physics/2d/default_linear_damp setting or any value override set by an Area2D the body is in. Depending on RigidBody2D.LinearDampMode, you can set RigidBody2D.LinearDamp to be added to or to replace the body's damping value. See ProjectSettings.physics/2d/default_linear_damp for more details about damping.

LinearDampModeProperty
# LinearDampMode
C#
public RigidBody2D.DampMode LinearDampMode { get; set; }

Defines how RigidBody2D.LinearDamp is applied.

LinearVelocityProperty
# LinearVelocity
C#
public Vector2 LinearVelocity { get; set; }

The body's linear velocity in pixels per second. Can be used sporadically, but don't set this every frame, because physics may run in another thread and runs at a different granularity. Use RigidBody2D._IntegrateForces as your process loop for precise control of the body state.

LockRotationProperty
# LockRotation
C#
public bool LockRotation { get; set; }

If true, the body cannot rotate. Gravity and forces only apply linear movement.

MassProperty
# Mass
C#
public float Mass { get; set; }

Positive body mass. The same impulse changes velocity less at greater mass. Values at or below zero are rejected; do not use mass 0 to create a stationary body.

MaxContactsReportedProperty
# MaxContactsReported
C#
public int MaxContactsReported { get; set; }

The maximum number of contacts that will be recorded. Requires a value greater than 0 and RigidBody2D.ContactMonitor to be set to true to start to register contacts. Use RigidBody2D.GetContactCount to retrieve the count or RigidBody2D.GetCollidingBodies to retrieve bodies that have been collided with. Note: The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end), and collisions between parallel faces will result in four contacts (one at each corner).

PhysicsMaterialOverrideProperty
# PhysicsMaterialOverride
C#
public PhysicsMaterial PhysicsMaterialOverride { get; set; }

The physics material override for the body. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.

SleepingProperty
# Sleeping
C#
public bool Sleeping { get; set; }

If true, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the RigidBody2D.ApplyImpulse or RigidBody2D.ApplyForce methods.

Methods61

AddConstantCentralForcevoid
# AddConstantCentralForce
C#
public void AddConstantCentralForce(Vector2 force);

Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with constant_force = Vector2(0, 0). This is equivalent to using RigidBody2D.AddConstantForce at the body's center of mass.

Parameters
NameTypeDefault
forceVector2—
AddConstantForcevoid
# AddConstantForce
C#
public void AddConstantForce(Vector2 force, Vector2? position = default);

Adds a constant positioned force to the body that keeps being applied over time until cleared with constant_force = Vector2(0, 0). position is the offset from the body origin in global coordinates.

Parameters
NameTypeDefault
forceVector2—
positionVector2?default
position

If the parameter is null, then the default value is new Vector2(0.0f, 0.0f).

AddConstantTorquevoid
# AddConstantTorque
C#
public void AddConstantTorque(float torque);

Adds a constant rotational force without affecting position that keeps being applied over time until cleared with constant_torque = 0.

Parameters
NameTypeDefault
torquefloat—
ApplyCentralForcevoid
# ApplyCentralForce
C#
public void ApplyCentralForce(Vector2 force);

Adds central force for the current physics tick. For thrust, call on every required tick; the integrator accounts for time. A single call does not install a persistent force.

Parameters
NameTypeDefault
forceVector2—
force

Force vector in global axes, not displacement or force premultiplied by delta.

ApplyCentralImpulsevoid
# ApplyCentralImpulse
C#
public void ApplyCentralImpulse(Vector2? impulse = default);

Applies a one-off central impulse. Do not multiply by delta or repeat each frame for continuous thrust. In the check, impulse 20 on X at mass 2 produced velocity 10 without gravity or damping.

Parameters
NameTypeDefault
impulseVector2?default
impulse

Impulse vector in global axes. Omitting the optional value supplies a zero vector.

ApplyForcevoid
# ApplyForce
C#
public void ApplyForce(Vector2 force, Vector2? position = default);

Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update. position is the offset from the body origin in global coordinates.

Parameters
NameTypeDefault
forceVector2—
positionVector2?default
position

If the parameter is null, then the default value is new Vector2(0.0f, 0.0f).

ApplyImpulsevoid
# ApplyImpulse
C#
public void ApplyImpulse(Vector2 impulse, Vector2? position = default);

Applies a positioned impulse to the body. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). position is the offset from the body origin in global coordinates.

Parameters
NameTypeDefault
impulseVector2—
positionVector2?default
position

If the parameter is null, then the default value is new Vector2(0.0f, 0.0f).

ApplyTorquevoid
# ApplyTorque
C#
public void ApplyTorque(float torque);

Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update. Note: RigidBody2D.Inertia is required for this to work. To have RigidBody2D.Inertia, an active CollisionShape2D must be a child of the node, or you can manually set RigidBody2D.Inertia.

Parameters
NameTypeDefault
torquefloat—
ApplyTorqueImpulsevoid
# ApplyTorqueImpulse
C#
public void ApplyTorqueImpulse(float torque);

Applies a rotational impulse to the body without affecting the position. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). Note: RigidBody2D.Inertia is required for this to work. To have RigidBody2D.Inertia, an active CollisionShape2D must be a child of the node, or you can manually set RigidBody2D.Inertia.

Parameters
NameTypeDefault
torquefloat—
GetAngularDampfloat
# GetAngularDamp
C#
public float GetAngularDamp();
Returns float
GetAngularDampModeRigidBody2D.DampMode
# GetAngularDampMode
C#
public RigidBody2D.DampMode GetAngularDampMode();
Returns RigidBody2D.DampMode
GetAngularVelocityfloat
# GetAngularVelocity
C#
public float GetAngularVelocity();
Returns float
GetCenterOfMassVector2
# GetCenterOfMass
C#
public Vector2 GetCenterOfMass();
Returns Vector2
GetCenterOfMassModeRigidBody2D.CenterOfMassModeEnum
# GetCenterOfMassMode
C#
public RigidBody2D.CenterOfMassModeEnum GetCenterOfMassMode();
Returns RigidBody2D.CenterOfMassModeEnum
GetCollidingBodiesReckfell.Collections.Array<Entity2D>
# GetCollidingBodies
C#
public Reckfell.Collections.Array<Entity2D> GetCollidingBodies();

Returns a list of the bodies colliding with this one. Requires RigidBody2D.ContactMonitor to be set to true and RigidBody2D.MaxContactsReported to be set high enough to detect all the collisions. Note: The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead.

Returns Reckfell.Collections.Array<Entity2D>
GetConstantForceVector2
# GetConstantForce
C#
public Vector2 GetConstantForce();
Returns Vector2
GetConstantTorquefloat
# GetConstantTorque
C#
public float GetConstantTorque();
Returns float
GetContactCountint
# GetContactCount
C#
public int GetContactCount();

Returns the number of contacts this body has with other bodies. By default, this returns 0 unless bodies are configured to monitor contacts (see RigidBody2D.ContactMonitor). Note: To retrieve the colliding bodies, use RigidBody2D.GetCollidingBodies.

Returns int
GetContinuousCollisionDetectionModeRigidBody2D.CcdMode
# GetContinuousCollisionDetectionMode
C#
public RigidBody2D.CcdMode GetContinuousCollisionDetectionMode();
Returns RigidBody2D.CcdMode
GetFreezeModeRigidBody2D.FreezeModeEnum
# GetFreezeMode
C#
public RigidBody2D.FreezeModeEnum GetFreezeMode();
Returns RigidBody2D.FreezeModeEnum
GetGravityScalefloat
# GetGravityScale
C#
public float GetGravityScale();
Returns float
GetInertiafloat
# GetInertia
C#
public float GetInertia();
Returns float
GetLinearDampfloat
# GetLinearDamp
C#
public float GetLinearDamp();
Returns float
GetLinearDampModeRigidBody2D.DampMode
# GetLinearDampMode
C#
public RigidBody2D.DampMode GetLinearDampMode();
Returns RigidBody2D.DampMode
GetLinearVelocityVector2
# GetLinearVelocity
C#
public Vector2 GetLinearVelocity();
Returns Vector2
GetMassfloat
# GetMass
C#
public float GetMass();
Returns float
GetMaxContactsReportedint
# GetMaxContactsReported
C#
public int GetMaxContactsReported();
Returns int
GetPhysicsMaterialOverridePhysicsMaterial
# GetPhysicsMaterialOverride
C#
public PhysicsMaterial GetPhysicsMaterialOverride();
Returns PhysicsMaterial
GetVelocityAtLocalPositionVector2
# GetVelocityAtLocalPosition
C#
public Vector2 GetVelocityAtLocalPosition(Vector2 localPosition);

Returns the body's velocity at the given relative position. local_position is the offset from the body origin in global coordinates. See also RigidBody2D.GetVelocityAtPosition.

Parameters
NameTypeDefault
localPositionVector2—
Returns Vector2
GetVelocityAtPositionVector2
# GetVelocityAtPosition
C#
public Vector2 GetVelocityAtPosition(Vector2 globalPoint);

Returns the body's velocity at the given global position. This is equivalent to get_velocity_at_local_position(global_point - global_position). See also RigidBody2D.GetVelocityAtLocalPosition.

Parameters
NameTypeDefault
globalPointVector2—
Returns Vector2
IsAbleToSleepbool
# IsAbleToSleep
C#
public bool IsAbleToSleep();
Returns bool
IsContactMonitorEnabledbool
# IsContactMonitorEnabled
C#
public bool IsContactMonitorEnabled();
Returns bool
IsFreezeEnabledbool
# IsFreezeEnabled
C#
public bool IsFreezeEnabled();
Returns bool
IsLockRotationEnabledbool
# IsLockRotationEnabled
C#
public bool IsLockRotationEnabled();
Returns bool
IsSleepingbool
# IsSleeping
C#
public bool IsSleeping();
Returns bool
IsUsingCustomIntegratorbool
# IsUsingCustomIntegrator
C#
public bool IsUsingCustomIntegrator();
Returns bool
SetAngularDampvoid
# SetAngularDamp
C#
public void SetAngularDamp(float angularDamp);
Parameters
NameTypeDefault
angularDampfloat—
SetAngularDampModevoid
# SetAngularDampMode
C#
public void SetAngularDampMode(RigidBody2D.DampMode angularDampMode);
Parameters
NameTypeDefault
angularDampModeRigidBody2D.DampMode—
SetAngularVelocityvoid
# SetAngularVelocity
C#
public void SetAngularVelocity(float angularVelocity);
Parameters
NameTypeDefault
angularVelocityfloat—
SetAxisVelocityvoid
# SetAxisVelocity
C#
public void SetAxisVelocity(Vector2 axisVelocity);

Sets the body's velocity on the given axis. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.

Parameters
NameTypeDefault
axisVelocityVector2—
SetCanSleepvoid
# SetCanSleep
C#
public void SetCanSleep(bool ableToSleep);
Parameters
NameTypeDefault
ableToSleepbool—
SetCenterOfMassvoid
# SetCenterOfMass
C#
public void SetCenterOfMass(Vector2 centerOfMass);
Parameters
NameTypeDefault
centerOfMassVector2—
SetCenterOfMassModevoid
# SetCenterOfMassMode
C#
public void SetCenterOfMassMode(RigidBody2D.CenterOfMassModeEnum mode);
Parameters
NameTypeDefault
modeRigidBody2D.CenterOfMassModeEnum—
SetConstantForcevoid
# SetConstantForce
C#
public void SetConstantForce(Vector2 force);
Parameters
NameTypeDefault
forceVector2—
SetConstantTorquevoid
# SetConstantTorque
C#
public void SetConstantTorque(float torque);
Parameters
NameTypeDefault
torquefloat—
SetContactMonitorvoid
# SetContactMonitor
C#
public void SetContactMonitor(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetContinuousCollisionDetectionModevoid
# SetContinuousCollisionDetectionMode
C#
public void SetContinuousCollisionDetectionMode(RigidBody2D.CcdMode mode);
Parameters
NameTypeDefault
modeRigidBody2D.CcdMode—
SetFreezeEnabledvoid
# SetFreezeEnabled
C#
public void SetFreezeEnabled(bool freezeMode);
Parameters
NameTypeDefault
freezeModebool—
SetFreezeModevoid
# SetFreezeMode
C#
public void SetFreezeMode(RigidBody2D.FreezeModeEnum freezeMode);
Parameters
NameTypeDefault
freezeModeRigidBody2D.FreezeModeEnum—
SetGravityScalevoid
# SetGravityScale
C#
public void SetGravityScale(float gravityScale);
Parameters
NameTypeDefault
gravityScalefloat—
SetInertiavoid
# SetInertia
C#
public void SetInertia(float inertia);
Parameters
NameTypeDefault
inertiafloat—
SetLinearDampvoid
# SetLinearDamp
C#
public void SetLinearDamp(float linearDamp);
Parameters
NameTypeDefault
linearDampfloat—
SetLinearDampModevoid
# SetLinearDampMode
C#
public void SetLinearDampMode(RigidBody2D.DampMode linearDampMode);
Parameters
NameTypeDefault
linearDampModeRigidBody2D.DampMode—
SetLinearVelocityvoid
# SetLinearVelocity
C#
public void SetLinearVelocity(Vector2 linearVelocity);
Parameters
NameTypeDefault
linearVelocityVector2—
SetLockRotationEnabledvoid
# SetLockRotationEnabled
C#
public void SetLockRotationEnabled(bool lockRotation);
Parameters
NameTypeDefault
lockRotationbool—
SetMassvoid
# SetMass
C#
public void SetMass(float mass);
Parameters
NameTypeDefault
massfloat—
SetMaxContactsReportedvoid
# SetMaxContactsReported
C#
public void SetMaxContactsReported(int amount);
Parameters
NameTypeDefault
amountint—
SetPhysicsMaterialOverridevoid
# SetPhysicsMaterialOverride
C#
public void SetPhysicsMaterialOverride(PhysicsMaterial physicsMaterialOverride);
Parameters
NameTypeDefault
physicsMaterialOverridePhysicsMaterial—
SetSleepingvoid
# SetSleeping
C#
public void SetSleeping(bool sleeping);
Parameters
NameTypeDefault
sleepingbool—
SetUseCustomIntegratorvoid
# SetUseCustomIntegrator
C#
public void SetUseCustomIntegrator(bool enable);
Parameters
NameTypeDefault
enablebool—
_IntegrateForcesvoid
# _IntegrateForces
C#
public virtual void _IntegrateForces(PhysicsDirectBodyState2D state);

A physics callback for controlled state modification. For teleporting, set state.Transform and explicitly clear required velocities. Do not substitute repeated Position writes in _Process for the integrator.

Parameters
NameTypeDefault
statePhysicsDirectBodyState2D—

Signals and events5

BodyEnteredEvent
# BodyEntered
C#
public event RigidBody2D.BodyEnteredEventHandler BodyEntered;

Emitted when a collision with another PhysicsBody2D or TileMap occurs. Requires RigidBody2D.ContactMonitor to be set to true and RigidBody2D.MaxContactsReported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body the Entity, if it exists in the tree, of the other PhysicsBody2D or TileMap.

Handler parameters
NameTypeDefault
bodyEntity—
BodyExitedEvent
# BodyExited
C#
public event RigidBody2D.BodyExitedEventHandler BodyExited;

Emitted when the collision with another PhysicsBody2D or TileMap ends. Requires RigidBody2D.ContactMonitor to be set to true and RigidBody2D.MaxContactsReported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body the Entity, if it exists in the tree, of the other PhysicsBody2D or TileMap.

Handler parameters
NameTypeDefault
bodyEntity—
BodyShapeEnteredEvent
# BodyShapeEntered
C#
public event RigidBody2D.BodyShapeEnteredEventHandler BodyShapeEntered;

Emitted when one of this RigidBody2D's Shape2Ds collides with another PhysicsBody2D or TileMap's Shape2Ds. Requires RigidBody2D.ContactMonitor to be set to true and RigidBody2D.MaxContactsReported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body_rid the Rid of the other PhysicsBody2D or TileSet's CollisionObject2D used by the PhysicsServer2D. body the Entity, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_shape_index the index of the Shape2D of the other PhysicsBody2D or TileMap used by the PhysicsServer2D. Get the CollisionShape2D node with body.shape_owner_get_owner(body.shape_find_owner(body_shape_index)). local_shape_index the index of the Shape2D of this RigidBody2D used by the PhysicsServer2D. Get the CollisionShape2D node with self.shape_owner_get_owner(self.shape_find_owner(local_shape_index)).

Handler parameters
NameTypeDefault
bodyRidRid—
bodyEntity—
bodyShapeIndexlong—
localShapeIndexlong—
BodyShapeExitedEvent
# BodyShapeExited
C#
public event RigidBody2D.BodyShapeExitedEventHandler BodyShapeExited;

Emitted when the collision between one of this RigidBody2D's Shape2Ds and another PhysicsBody2D or TileMap's Shape2Ds ends. Requires RigidBody2D.ContactMonitor to be set to true and RigidBody2D.MaxContactsReported to be set high enough to detect all the collisions. TileMaps are detected if the TileSet has Collision Shape2Ds. body_rid the Rid of the other PhysicsBody2D or TileSet's CollisionObject2D used by the PhysicsServer2D. body the Entity, if it exists in the tree, of the other PhysicsBody2D or TileMap. body_shape_index the index of the Shape2D of the other PhysicsBody2D or TileMap used by the PhysicsServer2D. Get the CollisionShape2D node with body.shape_owner_get_owner(body.shape_find_owner(body_shape_index)). local_shape_index the index of the Shape2D of this RigidBody2D used by the PhysicsServer2D. Get the CollisionShape2D node with self.shape_owner_get_owner(self.shape_find_owner(local_shape_index)).

Handler parameters
NameTypeDefault
bodyRidRid—
bodyEntity—
bodyShapeIndexlong—
localShapeIndexlong—
SleepingStateChangedEvent
# SleepingStateChanged
C#
public event Action SleepingStateChanged;

Emitted when the physics engine changes the body's sleeping state. Note: Changing the value RigidBody2D.Sleeping will not trigger this signal. It is only emitted if the sleeping state is changed by the physics engine or emit_signal("sleeping_state_changed") is used.

RigidBody2D.CcdMode

ValueDescription
CastRay = 1

Continuous collision detection enabled using raycasting. This is faster than shapecasting but less precise.

CastShape = 2

Continuous collision detection enabled using shapecasting. This is the slowest CCD method and the most precise.

Disabled = 0

Continuous collision detection disabled. This is the fastest way to detect body collisions, but can miss small, fast-moving objects.

RigidBody2D.CenterOfMassModeEnum

ValueDescription
Auto = 0

In this mode, the body's center of mass is calculated automatically based on its shapes. This assumes that the shapes' origins are also their center of mass.

Custom = 1

In this mode, the body's center of mass is set through RigidBody2D.CenterOfMass. Defaults to the body's origin position.

RigidBody2D.DampMode

ValueDescription
Combine = 0

In this mode, the body's damping value is added to any value set in areas or the default value.

Replace = 1

In this mode, the body's damping value replaces any value set in areas or the default value.

RigidBody2D.FreezeModeEnum

ValueDescription
Kinematic = 1

Kinematic body freeze mode. Similar to RigidBody2D.FreezeModeEnum.Static, but collides with other bodies along its path when moved. Useful for a frozen body that needs to be animated.

Static = 0

Static body freeze mode (default). The body is not affected by gravity and forces. It can be only moved by user code and doesn't collide with other bodies along its path.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.