PhysicsBody3D

package
v0.0.0-...-568b220 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package PhysicsBody3D provides methods for working with PhysicsBody3D object instances.

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

type Expanded

type Expanded [1]gdclass.PhysicsBody3D

func (Expanded) MoveAndCollide

func (self Expanded) MoveAndCollide(motion Vector3.XYZ, test_only bool, safe_margin Float.X, recovery_as_collision bool, max_collisions int) KinematicCollision3D.Instance

Moves the body along the vector [param motion]. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code]. The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision when stopped, or when touching another body along the motion. If [param test_only] is [code]true[/code], the body does not move but the would-be collision information is given. [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details). If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is used e.g. by [CharacterBody3D] for improving floor detection during floor snapping. [param max_collisions] allows to retrieve more than one collision result.

func (Expanded) TestMove

func (self Expanded) TestMove(from Transform3D.BasisOrigin, motion Vector3.XYZ, collision KinematicCollision3D.Instance, safe_margin Float.X, recovery_as_collision bool, max_collisions int) bool

Checks for collisions without moving the body. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code]. Virtually sets the node's position, scale and rotation to that of the given [Transform3D], then tries to move the body along the vector [param motion]. Returns [code]true[/code] if a collision would stop the body from moving along the whole path. [param collision] is an optional object of type [KinematicCollision3D], which contains additional information about the collision when stopped, or when touching another body along the motion. [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details). If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is useful for checking whether the body would [i]touch[/i] any other bodies. [param max_collisions] allows to retrieve more than one collision result.

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

func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance

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

func (self *Extension[T]) AsPhysicsBody3D() 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.PhysicsBody3D

[PhysicsBody3D] is an abstract base class for 3D game objects affected by physics. All 3D physics bodies inherit from it. [b]Warning:[/b] With a non-uniform scale, this node will likely not behave as expected. It is advised to keep its scale the same on all axes and adjust its collision shape(s) instead.

var Nil Instance

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

func New

func New() Instance

func (Instance) AddCollisionExceptionWith

func (self Instance) AddCollisionExceptionWith(body Node.Instance)

Adds a body to the list of bodies that this body can't collide with.

func (Instance) AsCollisionObject3D

func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance

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

func (self Instance) AsPhysicsBody3D() Instance

func (Instance) AxisLockAngularX

func (self Instance) AxisLockAngularX() bool

func (Instance) AxisLockAngularY

func (self Instance) AxisLockAngularY() bool

func (Instance) AxisLockAngularZ

func (self Instance) AxisLockAngularZ() bool

func (Instance) AxisLockLinearX

func (self Instance) AxisLockLinearX() bool

func (Instance) AxisLockLinearY

func (self Instance) AxisLockLinearY() bool

func (Instance) AxisLockLinearZ

func (self Instance) AxisLockLinearZ() bool

func (Instance) GetCollisionExceptions

func (self Instance) GetCollisionExceptions() []Instance

Returns an array of nodes that were added as collision exceptions for this body.

func (Instance) GetGravity

func (self Instance) GetGravity() Vector3.XYZ

Returns the gravity vector computed from all sources that can affect the body, including all gravity overrides from [Area3D] nodes and the global world gravity.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MoveAndCollide

func (self Instance) MoveAndCollide(motion Vector3.XYZ) KinematicCollision3D.Instance

Moves the body along the vector [param motion]. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code]. The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision when stopped, or when touching another body along the motion. If [param test_only] is [code]true[/code], the body does not move but the would-be collision information is given. [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details). If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is used e.g. by [CharacterBody3D] for improving floor detection during floor snapping. [param max_collisions] allows to retrieve more than one collision result.

func (Instance) RemoveCollisionExceptionWith

func (self Instance) RemoveCollisionExceptionWith(body Node.Instance)

Removes a body from the list of bodies that this body can't collide with.

func (Instance) SetAxisLockAngularX

func (self Instance) SetAxisLockAngularX(value bool)

func (Instance) SetAxisLockAngularY

func (self Instance) SetAxisLockAngularY(value bool)

func (Instance) SetAxisLockAngularZ

func (self Instance) SetAxisLockAngularZ(value bool)

func (Instance) SetAxisLockLinearX

func (self Instance) SetAxisLockLinearX(value bool)

func (Instance) SetAxisLockLinearY

func (self Instance) SetAxisLockLinearY(value bool)

func (Instance) SetAxisLockLinearZ

func (self Instance) SetAxisLockLinearZ(value bool)

func (*Instance) SetObject

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

func (Instance) TestMove

func (self Instance) TestMove(from Transform3D.BasisOrigin, motion Vector3.XYZ) bool

Checks for collisions without moving the body. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code]. Virtually sets the node's position, scale and rotation to that of the given [Transform3D], then tries to move the body along the vector [param motion]. Returns [code]true[/code] if a collision would stop the body from moving along the whole path. [param collision] is an optional object of type [KinematicCollision3D], which contains additional information about the collision when stopped, or when touching another body along the motion. [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details). If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is useful for checking whether the body would [i]touch[/i] any other bodies. [param max_collisions] allows to retrieve more than one collision result.

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