Class SpringArm3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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).
public class SpringArm3D : Node3D, IDisposable
- Inheritance
-
SpringArm3D
- Implements
- Inherited Members
Constructors
SpringArm3D()
public SpringArm3D()
Properties
CollisionMask
The layers against which the collision check shall be done. See Collision layers and masks in the documentation for more information.
public uint CollisionMask { get; set; }
Property Value
Margin
When the collision check is made, a candidate length for the SpringArm3D is given.
The margin is then subtracted to this length and the translation is applied to the child objects of the SpringArm3D.
This margin is useful for when the SpringArm3D has a Camera3D as a child node: without the margin, the Camera3D would be placed on the exact point of collision, while with the margin the Camera3D would be placed close to the point of collision.
public float Margin { get; set; }
Property Value
Shape
The Shape3D to use for the SpringArm3D.
When the shape is set, the SpringArm3D will cast the Shape3D on its z axis instead of performing a ray cast.
public Shape3D Shape { get; set; }
Property Value
SpringLength
The maximum extent of the SpringArm3D. This is used as a length for both the ray and the shape cast used internally to calculate the desired position of the SpringArm3D's child nodes.
To know more about how to perform a shape cast or a ray cast, please consult the PhysicsDirectSpaceState3D documentation.
public float SpringLength { get; set; }
Property Value
Methods
AddExcludedObject(Rid)
Adds the PhysicsBody3D object with the given Rid to the list of PhysicsBody3D objects excluded from the collision check.
public void AddExcludedObject(Rid rID)
Parameters
rID
Rid
ClearExcludedObjects()
Clears the list of PhysicsBody3D objects excluded from the collision check.
public void ClearExcludedObjects()
GetHitLength()
Returns the spring arm's current length.
public float GetHitLength()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
RemoveExcludedObject(Rid)
Removes the given Rid from the list of PhysicsBody3D objects excluded from the collision check.
public bool RemoveExcludedObject(Rid rID)
Parameters
rID
Rid