SpringArm3D

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsSpringArm3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsSpringArm3D

func (self *Extension[T]) AsSpringArm3D() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.SpringArm3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddExcludedObject

func (self Instance) AddExcludedObject(rid RID.Body3D)

Adds the PhysicsBody3D object with the given Resource.ID to the list of PhysicsBody3D objects excluded from the collision check.

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsSpringArm3D

func (self Instance) AsSpringArm3D() Instance

func (Instance) ClearExcludedObjects

func (self Instance) ClearExcludedObjects()

Clears the list of PhysicsBody3D objects excluded from the collision check.

func (Instance) CollisionMask

func (self Instance) CollisionMask() int

The layers against which the collision check shall be done. See Collision layers and masks in the documentation for more information.

func (Instance) GetHitLength

func (self Instance) GetHitLength() Float.X

Returns the spring arm's current length.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Margin

func (self Instance) Margin() Float.X

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.

func (Instance) RemoveExcludedObject

func (self Instance) RemoveExcludedObject(rid RID.Body3D) bool

Removes the given Resource.ID from the list of PhysicsBody3D objects excluded from the collision check.

func (Instance) SetCollisionMask

func (self Instance) SetCollisionMask(value int)

SetCollisionMask sets the property returned by [GetCollisionMask].

func (Instance) SetMargin

func (self Instance) SetMargin(value Float.X)

SetMargin sets the property returned by [GetMargin].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetShape

func (self Instance) SetShape(value Shape3D.Instance)

SetShape sets the property returned by [GetShape].

func (Instance) SetSpringLength

func (self Instance) SetSpringLength(value Float.X)

SetSpringLength sets the property returned by [GetLength].

func (Instance) Shape

func (self Instance) Shape() Shape3D.Instance

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.

func (Instance) SpringLength

func (self Instance) SpringLength() Float.X

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.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL