Documentation
¶
Overview ¶
An animatable 2D physics body. It can't be moved by external forces or contacts, but can be moved manually by other means such as code, AnimationMixers (with AnimationMixer.CallbackModeProcess set to [Animationmixer.AnimationCallbackModeProcessPhysics]), and RemoteTransform2D.
When AnimatableBody2D is moved, its linear and angular velocity are estimated and used to affect other physics bodies in its path. This makes it useful for moving platforms, doors, and other moving objects.
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsAnimatableBody2D() Instance
- func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
- func (self *Extension[T]) AsCollisionObject2D() CollisionObject2D.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode2D() Node2D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsPhysicsBody2D() PhysicsBody2D.Instance
- func (self *Extension[T]) AsStaticBody2D() StaticBody2D.Instance
- type ID
- type Instance
- func (self Instance) AsAnimatableBody2D() Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsCollisionObject2D() CollisionObject2D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPhysicsBody2D() PhysicsBody2D.Instance
- func (self Instance) AsStaticBody2D() StaticBody2D.Instance
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSyncToPhysics(value bool)
- func (self Instance) SyncToPhysics() 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 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]) AsAnimatableBody2D ¶
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsCollisionObject2D ¶
func (self *Extension[T]) AsCollisionObject2D() CollisionObject2D.Instance
func (*Extension[T]) AsPhysicsBody2D ¶
func (self *Extension[T]) AsPhysicsBody2D() PhysicsBody2D.Instance
func (*Extension[T]) AsStaticBody2D ¶
func (self *Extension[T]) AsStaticBody2D() StaticBody2D.Instance
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.AnimatableBody2D
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) AsAnimatableBody2D ¶
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsCollisionObject2D ¶
func (self Instance) AsCollisionObject2D() CollisionObject2D.Instance
func (Instance) AsPhysicsBody2D ¶
func (self Instance) AsPhysicsBody2D() PhysicsBody2D.Instance
func (Instance) AsStaticBody2D ¶
func (self Instance) AsStaticBody2D() StaticBody2D.Instance
func (Instance) SetSyncToPhysics ¶
SetSyncToPhysics sets the property returned by [IsSyncToPhysicsEnabled].
func (Instance) SyncToPhysics ¶
If true, the body's movement will be synchronized to the physics frame. This is useful when animating movement via AnimationPlayer, for example on moving platforms. Do not use together with PhysicsBody2D.MoveAndCollide.