Documentation
¶
Overview ¶
Holds collision data from the movement of a graphics.gd/classdb/PhysicsBody2D, usually from graphics.gd/classdb/PhysicsBody2D.Instance.MoveAndCollide. When a graphics.gd/classdb/PhysicsBody2D is moved, it stops if it detects a collision with another body. If a collision is detected, a graphics.gd/classdb/KinematicCollision2D 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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AsKinematicCollision2D() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) GetAngle() Angle.Radians
- func (self Instance) GetCollider() Object.Instance
- func (self Instance) GetColliderId() int
- func (self Instance) GetColliderRid() RID.Body2D
- func (self Instance) GetColliderShape() Object.Instance
- func (self Instance) GetColliderShapeIndex() int
- func (self Instance) GetColliderVelocity() Vector2.XY
- func (self Instance) GetDepth() Float.X
- func (self Instance) GetLocalShape() Object.Instance
- func (self Instance) GetNormal() Vector2.XY
- func (self Instance) GetPosition() Vector2.XY
- func (self Instance) GetRemainder() Vector2.XY
- func (self Instance) GetTravel() Vector2.XY
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
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 Expanded ¶
type Expanded [1]gdclass.KinematicCollision2D
type Extension ¶
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]) AsKinematicCollision2D ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type 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.
type Instance ¶
type Instance [1]gdclass.KinematicCollision2D
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 (Instance) AsKinematicCollision2D ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) GetAngle ¶
Returns the collision angle according to 'up_direction', which is [Vector2.Up] by default. This value is always positive.
func (Instance) GetCollider ¶
Returns the colliding body's attached graphics.gd/classdb/Object.
func (Instance) GetColliderId ¶
Returns the unique instance ID of the colliding body's attached graphics.gd/classdb/Object. See graphics.gd/classdb/Object.Instance.GetInstanceId.
func (Instance) GetColliderRid ¶
Returns the colliding body's [Resource.ID] used by the graphics.gd/classdb/PhysicsServer2D.
func (Instance) GetColliderShape ¶
Returns the colliding body's shape.
func (Instance) GetColliderShapeIndex ¶
Returns the colliding body's shape index. See graphics.gd/classdb/CollisionObject2D.
func (Instance) GetColliderVelocity ¶
Returns the colliding body's velocity.
func (Instance) GetDepth ¶
Returns the colliding body's length of overlap along the collision normal.
func (Instance) GetLocalShape ¶
Returns the moving object's colliding shape.
func (Instance) GetPosition ¶
Returns the point of collision in global coordinates.
func (Instance) GetRemainder ¶
Returns the moving object's remaining movement vector.