reckfellENGINE

PhysicsDirectBodyState3D

Provides direct access to a physics body in the PhysicsServer3D.

On this page
class PhysicsDirectBodyState3DReckfellSharpInherits ReckfellObject

Provides direct access to a physics body in the PhysicsServer3D.

Provides direct access to a physics body in the PhysicsServer3D, allowing safe changes to physics properties. This object is passed via the direct state callback of RigidBody3D, and is intended for changing the direct state of that body. See RigidBody3D._IntegrateForces.

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

Properties16

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

The body's rotational velocity in radians per second.

CenterOfMassProperty
# CenterOfMass
C#
public Vector3 CenterOfMass { get; }

The body's center of mass position relative to the body's center in the global coordinate system.

CenterOfMassLocalProperty
# CenterOfMassLocal
C#
public Vector3 CenterOfMassLocal { get; }

The body's center of mass position in the body's local coordinate system.

CollisionLayerProperty
# CollisionLayer
C#
public uint CollisionLayer { get; set; }

The body's collision layer.

CollisionMaskProperty
# CollisionMask
C#
public uint CollisionMask { get; set; }

The body's collision mask.

InverseInertiaProperty
# InverseInertia
C#
public Vector3 InverseInertia { get; }

The inverse of the inertia of the body.

InverseInertiaTensorProperty
# InverseInertiaTensor
C#
public Basis InverseInertiaTensor { get; }

The inverse of the inertia tensor of the body.

InverseMassProperty
# InverseMass
C#
public float InverseMass { get; }

The inverse of the mass of the body.

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

The body's linear velocity in units per second.

PrincipalInertiaAxesProperty
# PrincipalInertiaAxes
C#
public Basis PrincipalInertiaAxes { get; }
SleepingProperty
# Sleeping
C#
public bool Sleeping { get; set; }

If true, this body is currently sleeping (not active).

StepProperty
# Step
C#
public float Step { get; }

The timestep (delta) used for the simulation.

TotalAngularDampProperty
# TotalAngularDamp
C#
public float TotalAngularDamp { get; }

The rate at which the body stops rotating, if there are not any other forces moving it.

TotalGravityProperty
# TotalGravity
C#
public Vector3 TotalGravity { get; }

The total gravity vector being currently applied to this body.

TotalLinearDampProperty
# TotalLinearDamp
C#
public float TotalLinearDamp { get; }

The rate at which the body stops moving, if there are not any other forces moving it.

TransformProperty
# Transform
C#
public Transform3D Transform { get; set; }

The body's transformation matrix.

Methods50

AddConstantCentralForcevoid
# AddConstantCentralForce
C#
public void AddConstantCentralForce(Vector3? force = default);

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

Parameters
NameTypeDefault
forceVector3?default
force

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

AddConstantForcevoid
# AddConstantForce
C#
public void AddConstantForce(Vector3 force, Vector3? position = default);

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

Parameters
NameTypeDefault
forceVector3—
positionVector3?default
position

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

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

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

Parameters
NameTypeDefault
torqueVector3—
ApplyCentralForcevoid
# ApplyCentralForce
C#
public void ApplyCentralForce(Vector3? force = default);

Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update. This is equivalent to using PhysicsDirectBodyState3D.ApplyForce at the body's center of mass.

Parameters
NameTypeDefault
forceVector3?default
force

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

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

Applies a directional impulse without affecting rotation. 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). This is equivalent to using PhysicsDirectBodyState3D.ApplyImpulse at the body's center of mass.

Parameters
NameTypeDefault
impulseVector3?default
impulse

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

ApplyForcevoid
# ApplyForce
C#
public void ApplyForce(Vector3 force, Vector3? 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
forceVector3—
positionVector3?default
position

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

ApplyImpulsevoid
# ApplyImpulse
C#
public void ApplyImpulse(Vector3 impulse, Vector3? 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
impulseVector3—
positionVector3?default
position

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

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

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

Parameters
NameTypeDefault
torqueVector3—
ApplyTorqueImpulsevoid
# ApplyTorqueImpulse
C#
public void ApplyTorqueImpulse(Vector3 impulse);

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: PhysicsDirectBodyState3D.InverseInertia is required for this to work. To have PhysicsDirectBodyState3D.InverseInertia, an active CollisionShape3D must be a child of the node, or you can manually set PhysicsDirectBodyState3D.InverseInertia.

Parameters
NameTypeDefault
impulseVector3—
GetAngularVelocityVector3
# GetAngularVelocity
C#
public Vector3 GetAngularVelocity();
Returns Vector3
GetCenterOfMassVector3
# GetCenterOfMass
C#
public Vector3 GetCenterOfMass();
Returns Vector3
GetCenterOfMassLocalVector3
# GetCenterOfMassLocal
C#
public Vector3 GetCenterOfMassLocal();
Returns Vector3
GetCollisionLayeruint
# GetCollisionLayer
C#
public uint GetCollisionLayer();
Returns uint
GetCollisionMaskuint
# GetCollisionMask
C#
public uint GetCollisionMask();
Returns uint
GetConstantForceVector3
# GetConstantForce
C#
public Vector3 GetConstantForce();

Returns the body's total constant positional forces applied during each physics update. See PhysicsDirectBodyState3D.AddConstantForce and PhysicsDirectBodyState3D.AddConstantCentralForce.

Returns Vector3
GetConstantTorqueVector3
# GetConstantTorque
C#
public Vector3 GetConstantTorque();

Returns the body's total constant rotational forces applied during each physics update. See PhysicsDirectBodyState3D.AddConstantTorque.

Returns Vector3
GetContactColliderRid
# GetContactCollider
C#
public Rid GetContactCollider(int contactIdx);

Returns the collider's Rid.

Parameters
NameTypeDefault
contactIdxint—
Returns Rid
GetContactColliderIdulong
# GetContactColliderId
C#
public ulong GetContactColliderId(int contactIdx);

Returns the collider's object id.

Parameters
NameTypeDefault
contactIdxint—
Returns ulong
GetContactColliderObjectReckfellObject
# GetContactColliderObject
C#
public ReckfellObject GetContactColliderObject(int contactIdx);

Returns the collider object.

Parameters
NameTypeDefault
contactIdxint—
Returns ReckfellObject
GetContactColliderPositionVector3
# GetContactColliderPosition
C#
public Vector3 GetContactColliderPosition(int contactIdx);

Returns the position of the contact point on the collider in the global coordinate system.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetContactColliderShapeint
# GetContactColliderShape
C#
public int GetContactColliderShape(int contactIdx);

Returns the collider's shape index.

Parameters
NameTypeDefault
contactIdxint—
Returns int
GetContactColliderVelocityAtPositionVector3
# GetContactColliderVelocityAtPosition
C#
public Vector3 GetContactColliderVelocityAtPosition(int contactIdx);

Returns the linear velocity vector at the collider's contact point.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetContactCountint
# GetContactCount
C#
public int GetContactCount();

Returns the number of contacts this body has with other bodies. Note: By default, this returns 0 unless bodies are configured to monitor contacts. See RigidBody3D.ContactMonitor.

Returns int
GetContactImpulseVector3
# GetContactImpulse
C#
public Vector3 GetContactImpulse(int contactIdx);

Impulse created by the contact.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetContactLocalNormalVector3
# GetContactLocalNormal
C#
public Vector3 GetContactLocalNormal(int contactIdx);

Returns the local normal at the contact point.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetContactLocalPositionVector3
# GetContactLocalPosition
C#
public Vector3 GetContactLocalPosition(int contactIdx);

Returns the position of the contact point on the body in the global coordinate system.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetContactLocalShapeint
# GetContactLocalShape
C#
public int GetContactLocalShape(int contactIdx);

Returns the local shape index of the collision.

Parameters
NameTypeDefault
contactIdxint—
Returns int
GetContactLocalVelocityAtPositionVector3
# GetContactLocalVelocityAtPosition
C#
public Vector3 GetContactLocalVelocityAtPosition(int contactIdx);

Returns the linear velocity vector at the body's contact point.

Parameters
NameTypeDefault
contactIdxint—
Returns Vector3
GetInverseInertiaVector3
# GetInverseInertia
C#
public Vector3 GetInverseInertia();
Returns Vector3
GetInverseInertiaTensorBasis
# GetInverseInertiaTensor
C#
public Basis GetInverseInertiaTensor();
Returns Basis
GetInverseMassfloat
# GetInverseMass
C#
public float GetInverseMass();
Returns float
GetLinearVelocityVector3
# GetLinearVelocity
C#
public Vector3 GetLinearVelocity();
Returns Vector3
GetPrincipalInertiaAxesBasis
# GetPrincipalInertiaAxes
C#
public Basis GetPrincipalInertiaAxes();
Returns Basis
GetSpaceStatePhysicsDirectSpaceState3D
# GetSpaceState
C#
public PhysicsDirectSpaceState3D GetSpaceState();

Returns the current state of the space, useful for queries.

Returns PhysicsDirectSpaceState3D
GetStepfloat
# GetStep
C#
public float GetStep();
Returns float
GetTotalAngularDampfloat
# GetTotalAngularDamp
C#
public float GetTotalAngularDamp();
Returns float
GetTotalGravityVector3
# GetTotalGravity
C#
public Vector3 GetTotalGravity();
Returns Vector3
GetTotalLinearDampfloat
# GetTotalLinearDamp
C#
public float GetTotalLinearDamp();
Returns float
GetTransformTransform3D
# GetTransform
C#
public Transform3D GetTransform();
Returns Transform3D
GetVelocityAtLocalPositionVector3
# GetVelocityAtLocalPosition
C#
public Vector3 GetVelocityAtLocalPosition(Vector3 localPosition);

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

Parameters
NameTypeDefault
localPositionVector3—
Returns Vector3
IntegrateForcesvoid
# IntegrateForces
C#
public void IntegrateForces();

Updates the body's linear and angular velocity by applying gravity and damping for the equivalent of one physics tick.

IsSleepingbool
# IsSleeping
C#
public bool IsSleeping();
Returns bool
SetAngularVelocityvoid
# SetAngularVelocity
C#
public void SetAngularVelocity(Vector3 velocity);
Parameters
NameTypeDefault
velocityVector3—
SetCollisionLayervoid
# SetCollisionLayer
C#
public void SetCollisionLayer(uint layer);
Parameters
NameTypeDefault
layeruint—
SetCollisionMaskvoid
# SetCollisionMask
C#
public void SetCollisionMask(uint mask);
Parameters
NameTypeDefault
maskuint—
SetConstantForcevoid
# SetConstantForce
C#
public void SetConstantForce(Vector3 force);

Sets the body's total constant positional forces applied during each physics update. See PhysicsDirectBodyState3D.AddConstantForce and PhysicsDirectBodyState3D.AddConstantCentralForce.

Parameters
NameTypeDefault
forceVector3—
SetConstantTorquevoid
# SetConstantTorque
C#
public void SetConstantTorque(Vector3 torque);

Sets the body's total constant rotational forces applied during each physics update. See PhysicsDirectBodyState3D.AddConstantTorque.

Parameters
NameTypeDefault
torqueVector3—
SetLinearVelocityvoid
# SetLinearVelocity
C#
public void SetLinearVelocity(Vector3 velocity);
Parameters
NameTypeDefault
velocityVector3—
SetSleepStatevoid
# SetSleepState
C#
public void SetSleepState(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetTransformvoid
# SetTransform
C#
public void SetTransform(Transform3D transform);
Parameters
NameTypeDefault
transformTransform3D—
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.