KinematicCollision3D

package
v0.0.0-...-ff35923 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Holds collision data from the movement of a graphics.gd/classdb/PhysicsBody3D, usually from graphics.gd/classdb/PhysicsBody3D.Instance.MoveAndCollide. When a graphics.gd/classdb/PhysicsBody3D is moved, it stops if it detects a collision with another body. If a collision is detected, a graphics.gd/classdb/KinematicCollision3D object is returned.

The collision data includes the colliding object, the remaining motion, and the collision position. This data can be used to determine a custom response to the collision.

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
	AsKinematicCollision3D() Instance
}

type Expanded

type Expanded [1]gdclass.KinematicCollision3D

func (Expanded) GetAngle

func (self Expanded) GetAngle(collision_index int, up_direction Vector3.XYZ) Angle.Radians

Returns the collision angle according to 'up_direction', which is [Vector3.Up] by default. This value is always positive.

func (Expanded) GetCollider

func (self Expanded) GetCollider(collision_index int) Object.Instance

Returns the colliding body's attached graphics.gd/classdb/Object given a collision index (the deepest collision by default).

func (Expanded) GetColliderId

func (self Expanded) GetColliderId(collision_index int) int

Returns the unique instance ID of the colliding body's attached graphics.gd/classdb/Object given a collision index (the deepest collision by default). See graphics.gd/classdb/Object.Instance.GetInstanceId.

func (Expanded) GetColliderRid

func (self Expanded) GetColliderRid(collision_index int) RID.Body3D

Returns the colliding body's [Resource.ID] used by the graphics.gd/classdb/PhysicsServer3D given a collision index (the deepest collision by default).

func (Expanded) GetColliderShape

func (self Expanded) GetColliderShape(collision_index int) Object.Instance

Returns the colliding body's shape given a collision index (the deepest collision by default).

func (Expanded) GetColliderShapeIndex

func (self Expanded) GetColliderShapeIndex(collision_index int) int

Returns the colliding body's shape index given a collision index (the deepest collision by default). See graphics.gd/classdb/CollisionObject3D.

func (Expanded) GetColliderVelocity

func (self Expanded) GetColliderVelocity(collision_index int) Vector3.XYZ

Returns the colliding body's velocity given a collision index (the deepest collision by default).

func (Expanded) GetLocalShape

func (self Expanded) GetLocalShape(collision_index int) Object.Instance

Returns the moving object's colliding shape given a collision index (the deepest collision by default).

func (Expanded) GetNormal

func (self Expanded) GetNormal(collision_index int) Vector3.XYZ

Returns the colliding body's shape's normal at the point of collision given a collision index (the deepest collision by default).

func (Expanded) GetPosition

func (self Expanded) GetPosition(collision_index int) Vector3.XYZ

Returns the point of collision in global coordinates given a collision index (the deepest collision by default).

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]) AsKinematicCollision3D

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

func (*Extension[T]) AsObject

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

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

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

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

func (self Instance) AsKinematicCollision3D() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) GetAngle

func (self Instance) GetAngle() Angle.Radians

Returns the collision angle according to 'up_direction', which is [Vector3.Up] by default. This value is always positive.

func (Instance) GetCollider

func (self Instance) GetCollider() Object.Instance

Returns the colliding body's attached graphics.gd/classdb/Object given a collision index (the deepest collision by default).

func (Instance) GetColliderId

func (self Instance) GetColliderId() int

Returns the unique instance ID of the colliding body's attached graphics.gd/classdb/Object given a collision index (the deepest collision by default). See graphics.gd/classdb/Object.Instance.GetInstanceId.

func (Instance) GetColliderRid

func (self Instance) GetColliderRid() RID.Body3D

Returns the colliding body's [Resource.ID] used by the graphics.gd/classdb/PhysicsServer3D given a collision index (the deepest collision by default).

func (Instance) GetColliderShape

func (self Instance) GetColliderShape() Object.Instance

Returns the colliding body's shape given a collision index (the deepest collision by default).

func (Instance) GetColliderShapeIndex

func (self Instance) GetColliderShapeIndex() int

Returns the colliding body's shape index given a collision index (the deepest collision by default). See graphics.gd/classdb/CollisionObject3D.

func (Instance) GetColliderVelocity

func (self Instance) GetColliderVelocity() Vector3.XYZ

Returns the colliding body's velocity given a collision index (the deepest collision by default).

func (Instance) GetCollisionCount

func (self Instance) GetCollisionCount() int

Returns the number of detected collisions.

func (Instance) GetDepth

func (self Instance) GetDepth() Float.X

Returns the colliding body's length of overlap along the collision normal.

func (Instance) GetLocalShape

func (self Instance) GetLocalShape() Object.Instance

Returns the moving object's colliding shape given a collision index (the deepest collision by default).

func (Instance) GetNormal

func (self Instance) GetNormal() Vector3.XYZ

Returns the colliding body's shape's normal at the point of collision given a collision index (the deepest collision by default).

func (Instance) GetPosition

func (self Instance) GetPosition() Vector3.XYZ

Returns the point of collision in global coordinates given a collision index (the deepest collision by default).

func (Instance) GetRemainder

func (self Instance) GetRemainder() Vector3.XYZ

Returns the moving object's remaining movement vector.

func (Instance) GetTravel

func (self Instance) GetTravel() Vector3.XYZ

Returns the moving object's travel before collision.

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

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

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