reckfellENGINE

PhysicalBone3D

A bone physics body bound to a skeleton.

On this page
class PhysicalBone3DReckfellSharpInherits PhysicsBody3D

PhysicalBone3D binds a physics body to a Skeleton3D bone through PhysicalBoneSimulator3D. Set its bone name through dynamic Set("bone_name", name); there is no public C# BoneName property here. GetBoneId checks binding.

BodyOffset and JointOffset describe different frames: body placement relative to the bone and the joint connection. A collider, mass and joint do not automatically form an anatomical model. Start/stop through the simulator and coordinate physics with animation and ordinary character control.

Working example.

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

Constructors1

PhysicalBone3DConstructor
# PhysicalBone3D
C#
public PhysicalBone3D();

Properties16

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

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

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

Defines how PhysicalBone3D.AngularDamp is applied.

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

The PhysicalBone3D's rotational velocity in radians per second.

BodyOffsetProperty
# BodyOffset
C#
public Transform3D BodyOffset { get; set; }

The physics body offset relative to its bound bone. Configure it with geometry and rest pose; moving only a visible mesh does not repair body/joint placement.

BounceProperty
# Bounce
C#
public float Bounce { get; set; }

The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness). Note: Even with PhysicalBone3D.Bounce set to 1.0, some energy will be lost over time due to linear and angular damping. To have a PhysicalBone3D that preserves all its energy over time, set PhysicalBone3D.Bounce to 1.0, PhysicalBone3D.LinearDampMode to PhysicalBone3D.DampMode.Replace, PhysicalBone3D.LinearDamp to 0.0, PhysicalBone3D.AngularDampMode to PhysicalBone3D.DampMode.Replace, and PhysicalBone3D.AngularDamp to 0.0.

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

If true, the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.

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 PhysicalBone3D._IntegrateForces method, if that virtual method is overridden. Setting this property will call the method PhysicsServer3D.BodySetOmitForceIntegration internally.

FrictionProperty
# Friction
C#
public float Friction { get; set; }

The body's friction, from 0 (frictionless) to 1 (max friction).

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

This is multiplied by ProjectSettings.physics/3d/default_gravity to produce this body's gravity. For example, a value of 1.0 will apply normal gravity, 2.0 will apply double the gravity, and 0.5 will apply half the gravity to this body.

JointOffsetProperty
# JointOffset
C#
public Transform3D JointOffset { get; set; }

The physics joint frame. Distinct from BodyOffset; check coordinate spaces, axes and limits for the chosen joint/backend.

JointRotationProperty
# JointRotation
C#
public Vector3 JointRotation { get; set; }

Sets the joint's rotation in radians.

JointTypeProperty
# JointType
C#
public PhysicalBone3D.JointTypeEnum JointType { get; set; }

Sets the joint type.

LinearDampProperty
# LinearDamp
C#
public float LinearDamp { get; set; }

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

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

Defines how PhysicalBone3D.LinearDamp is applied.

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

The body's linear velocity in units 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 PhysicalBone3D._IntegrateForces as your process loop for precise control of the body state.

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

The body's mass.

Methods39

ApplyCentralImpulsevoid
# ApplyCentralImpulse
C#
public void ApplyCentralImpulse(Vector3 impulse);

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 "_integrate_forces" functions otherwise). This is equivalent to using PhysicalBone3D.ApplyImpulse at the body's center of mass.

Parameters
NameTypeDefault
impulseVector3—
ApplyImpulsevoid
# ApplyImpulse
C#
public void ApplyImpulse(Vector3 impulse, Vector3? position = default);

Applies a positioned impulse to the PhysicsBone3D. 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 "_integrate_forces" functions otherwise). position is the offset from the PhysicsBone3D 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).

GetAngularDampfloat
# GetAngularDamp
C#
public float GetAngularDamp();
Returns float
GetAngularDampModePhysicalBone3D.DampMode
# GetAngularDampMode
C#
public PhysicalBone3D.DampMode GetAngularDampMode();
Returns PhysicalBone3D.DampMode
GetAngularVelocityVector3
# GetAngularVelocity
C#
public Vector3 GetAngularVelocity();
Returns Vector3
GetBodyOffsetTransform3D
# GetBodyOffset
C#
public Transform3D GetBodyOffset();
Returns Transform3D
GetBoneIdint
# GetBoneId
C#
public int GetBoneId();

The bound skeleton bone index; -1 indicates no binding. Check dynamic bone_name and simulator/Skeleton3D hierarchy. This is not an entity-tree child index.

Returns int
GetBouncefloat
# GetBounce
C#
public float GetBounce();
Returns float
GetFrictionfloat
# GetFriction
C#
public float GetFriction();
Returns float
GetGravityScalefloat
# GetGravityScale
C#
public float GetGravityScale();
Returns float
GetJointOffsetTransform3D
# GetJointOffset
C#
public Transform3D GetJointOffset();
Returns Transform3D
GetJointRidRid
# GetJointRid
C#
public Rid GetJointRid();

Returns the joint's internal Rid from the PhysicsServer3D.

Returns Rid
GetJointRotationVector3
# GetJointRotation
C#
public Vector3 GetJointRotation();
Returns Vector3
GetJointTypePhysicalBone3D.JointTypeEnum
# GetJointType
C#
public PhysicalBone3D.JointTypeEnum GetJointType();
Returns PhysicalBone3D.JointTypeEnum
GetLinearDampfloat
# GetLinearDamp
C#
public float GetLinearDamp();
Returns float
GetLinearDampModePhysicalBone3D.DampMode
# GetLinearDampMode
C#
public PhysicalBone3D.DampMode GetLinearDampMode();
Returns PhysicalBone3D.DampMode
GetLinearVelocityVector3
# GetLinearVelocity
C#
public Vector3 GetLinearVelocity();
Returns Vector3
GetMassfloat
# GetMass
C#
public float GetMass();
Returns float
GetSimulatePhysicsbool
# GetSimulatePhysics
C#
public bool GetSimulatePhysics();

Returns true if the PhysicsBone3D is allowed to simulate physics.

Returns bool
IsAbleToSleepbool
# IsAbleToSleep
C#
public bool IsAbleToSleep();
Returns bool
IsSimulatingPhysicsbool
# IsSimulatingPhysics
C#
public bool IsSimulatingPhysics();

Returns true if the PhysicsBone3D is currently simulating physics.

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(PhysicalBone3D.DampMode angularDampMode);
Parameters
NameTypeDefault
angularDampModePhysicalBone3D.DampMode—
SetAngularVelocityvoid
# SetAngularVelocity
C#
public void SetAngularVelocity(Vector3 angularVelocity);
Parameters
NameTypeDefault
angularVelocityVector3—
SetBodyOffsetvoid
# SetBodyOffset
C#
public void SetBodyOffset(Transform3D offset);
Parameters
NameTypeDefault
offsetTransform3D—
SetBouncevoid
# SetBounce
C#
public void SetBounce(float bounce);
Parameters
NameTypeDefault
bouncefloat—
SetCanSleepvoid
# SetCanSleep
C#
public void SetCanSleep(bool ableToSleep);
Parameters
NameTypeDefault
ableToSleepbool—
SetFrictionvoid
# SetFriction
C#
public void SetFriction(float friction);
Parameters
NameTypeDefault
frictionfloat—
SetGravityScalevoid
# SetGravityScale
C#
public void SetGravityScale(float gravityScale);
Parameters
NameTypeDefault
gravityScalefloat—
SetJointOffsetvoid
# SetJointOffset
C#
public void SetJointOffset(Transform3D offset);
Parameters
NameTypeDefault
offsetTransform3D—
SetJointRotationvoid
# SetJointRotation
C#
public void SetJointRotation(Vector3 euler);
Parameters
NameTypeDefault
eulerVector3—
SetJointTypevoid
# SetJointType
C#
public void SetJointType(PhysicalBone3D.JointTypeEnum jointType);
Parameters
NameTypeDefault
jointTypePhysicalBone3D.JointTypeEnum—
SetLinearDampvoid
# SetLinearDamp
C#
public void SetLinearDamp(float linearDamp);
Parameters
NameTypeDefault
linearDampfloat—
SetLinearDampModevoid
# SetLinearDampMode
C#
public void SetLinearDampMode(PhysicalBone3D.DampMode linearDampMode);
Parameters
NameTypeDefault
linearDampModePhysicalBone3D.DampMode—
SetLinearVelocityvoid
# SetLinearVelocity
C#
public void SetLinearVelocity(Vector3 linearVelocity);
Parameters
NameTypeDefault
linearVelocityVector3—
SetMassvoid
# SetMass
C#
public void SetMass(float mass);
Parameters
NameTypeDefault
massfloat—
SetUseCustomIntegratorvoid
# SetUseCustomIntegrator
C#
public void SetUseCustomIntegrator(bool enable);
Parameters
NameTypeDefault
enablebool—
_IntegrateForcesvoid
# _IntegrateForces
C#
public virtual void _IntegrateForces(PhysicsDirectBodyState3D state);

Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the PhysicalBone3D.CustomIntegrator property allows you to disable the standard force integration and do fully custom force integration for a body.

Parameters
NameTypeDefault
statePhysicsDirectBodyState3D—

PhysicalBone3D.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.

PhysicalBone3D.JointTypeEnum

ValueDescription
Cone = 2

A cone joint is applied to the PhysicsBone3D.

Hinge = 3

A hinge joint is applied to the PhysicsBone3D.

None = 0

No joint is applied to the PhysicsBone3D.

Pin = 1

A pin joint is applied to the PhysicsBone3D.

Slider = 4

A slider joint is applied to the PhysicsBone3D.

Type6Dof = 5

A 6 degrees of freedom joint is applied to the PhysicsBone3D.

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.