SpringArm3D
A 3D raycast that dynamically moves its children near the collision point.
A 3D raycast that dynamically moves its children near the collision point.
SpringArm3D casts a ray or a shape along its Z axis and moves all its direct children to the collision point, with an optional margin. This is useful for 3rd person cameras that move closer to the player when inside a tight space (you may need to exclude the player's collider from the SpringArm3D's collision check).
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
SpringArm3DConstructor
public SpringArm3D();Properties4
CollisionMaskProperty
public uint CollisionMask { get; set; }Physics-layer bits matched by the obstacle query. A value of 1 matches the first layer; 0 matches none. Unrelated to camera render layers. Exclude the character body separately using its physics RID.
MarginProperty
public float Margin { get; set; }Hit-distance offset for the ray-cast branch only. The verified version does not subtract it for an explicit Shape or the automatic shape of a direct Camera3D child. Choose suitable shape dimensions; Margin is not universal camera clearance.
ShapeProperty
public Shape3D Shape { get; set; }Obstacle query shape. If null with a direct Camera3D child, the camera supplies an automatic shape; without that child, the query uses a ray. The verified explicit-shape branch does not subtract Margin. Changes take effect on a physics update.
SpringLengthProperty
public float SpringLength { get; set; }Requested cast length along local +Z transformed by the global basis, not the collision-shortened distance. Keep the hierarchy scale at one for predictable units. GetHitLength reads the last physics result.
Methods12
AddExcludedObjectvoid
public void AddExcludedObject(Rid rID);Excludes a physics object from spring queries. Pass body.GetRid() for the character so it does not shorten its own camera arm. This does not disable the body’s own collisions.
| Name | Type | Default |
|---|---|---|
rID | Rid | — |
rIDPhysics-body RID obtained through GetRid(), not an entity instance ID or mesh RID.
ClearExcludedObjectsvoid
public void ClearExcludedObjects();Clears the list of PhysicsBody3D objects excluded from the collision check.
GetCollisionMaskuint
public uint GetCollisionMask();uintGetHitLengthfloat
public float GetHitLength();Returns the distance calculated on the last physics update. Changing SpringLength or Shape does not recalculate it immediately. All direct Entity3D children are moved to that distance, not just the camera.
floatLast calculated length, equal to SpringLength when no matching obstacle is hit. Wait for the first physics update before relying on this result.
GetLengthfloat
public float GetLength();floatGetMarginfloat
public float GetMargin();floatGetShapeShape3D
public Shape3D GetShape();Shape3DRemoveExcludedObjectbool
public bool RemoveExcludedObject(Rid rID);Removes the given Rid from the list of PhysicsBody3D objects excluded from the collision check.
| Name | Type | Default |
|---|---|---|
rID | Rid | — |
boolSetCollisionMaskvoid
public void SetCollisionMask(uint mask);| Name | Type | Default |
|---|---|---|
mask | uint | — |
SetLengthvoid
public void SetLength(float length);| Name | Type | Default |
|---|---|---|
length | float | — |
SetMarginvoid
public void SetMargin(float margin);| Name | Type | Default |
|---|---|---|
margin | float | — |
SetShapevoid
public void SetShape(Shape3D shape);| Name | Type | Default |
|---|---|---|
shape | Shape3D | — |