Documentation ¶
Overview ¶
Package CharacterBody3D provides methods for working with CharacterBody3D object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) ApplyFloorSnap()
- func (self Instance) AsCharacterBody3D() Instance
- func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
- func (self Instance) FloorBlockOnWall() bool
- func (self Instance) FloorConstantSpeed() bool
- func (self Instance) FloorMaxAngle() Float.X
- func (self Instance) FloorSnapLength() Float.X
- func (self Instance) FloorStopOnSlope() bool
- func (self Instance) GetFloorAngle() Float.X
- func (self Instance) GetFloorNormal() Vector3.XYZ
- func (self Instance) GetLastMotion() Vector3.XYZ
- func (self Instance) GetLastSlideCollision() [1]gdclass.KinematicCollision3D
- func (self Instance) GetPlatformAngularVelocity() Vector3.XYZ
- func (self Instance) GetPlatformVelocity() Vector3.XYZ
- func (self Instance) GetPositionDelta() Vector3.XYZ
- func (self Instance) GetRealVelocity() Vector3.XYZ
- func (self Instance) GetSlideCollision(slide_idx int) [1]gdclass.KinematicCollision3D
- func (self Instance) GetSlideCollisionCount() int
- func (self Instance) GetWallNormal() Vector3.XYZ
- func (self Instance) IsOnCeiling() bool
- func (self Instance) IsOnCeilingOnly() bool
- func (self Instance) IsOnFloor() bool
- func (self Instance) IsOnFloorOnly() bool
- func (self Instance) IsOnWall() bool
- func (self Instance) IsOnWallOnly() bool
- func (self Instance) MaxSlides() int
- func (self Instance) MotionMode() gdclass.CharacterBody3DMotionMode
- func (self Instance) MoveAndSlide() bool
- func (self Instance) PlatformFloorLayers() int
- func (self Instance) PlatformOnLeave() gdclass.CharacterBody3DPlatformOnLeave
- func (self Instance) PlatformWallLayers() int
- func (self Instance) SafeMargin() Float.X
- func (self Instance) SetFloorBlockOnWall(value bool)
- func (self Instance) SetFloorConstantSpeed(value bool)
- func (self Instance) SetFloorMaxAngle(value Float.X)
- func (self Instance) SetFloorSnapLength(value Float.X)
- func (self Instance) SetFloorStopOnSlope(value bool)
- func (self Instance) SetMaxSlides(value int)
- func (self Instance) SetMotionMode(value gdclass.CharacterBody3DMotionMode)
- func (self Instance) SetPlatformFloorLayers(value int)
- func (self Instance) SetPlatformOnLeave(value gdclass.CharacterBody3DPlatformOnLeave)
- func (self Instance) SetPlatformWallLayers(value int)
- func (self Instance) SetSafeMargin(value Float.X)
- func (self Instance) SetSlideOnCeiling(value bool)
- func (self Instance) SetUpDirection(value Vector3.XYZ)
- func (self Instance) SetVelocity(value Vector3.XYZ)
- func (self Instance) SetWallMinSlideAngle(value Float.X)
- func (self Instance) SlideOnCeiling() bool
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) UpDirection() Vector3.XYZ
- func (self Instance) Velocity() Vector3.XYZ
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) WallMinSlideAngle() Float.X
- type MotionMode
- type PlatformOnLeave
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 Instance ¶
type Instance [1]gdclass.CharacterBody3D
[CharacterBody3D] is a specialized class for physics bodies that are meant to be user-controlled. They are not affected by physics at all, but they affect other physics bodies in their path. They are mainly used to provide high-level API to move objects with wall and slope detection ([method move_and_slide] method) in addition to the general collision detection provided by [method PhysicsBody3D.move_and_collide]. This makes it useful for highly configurable physics bodies that must move in specific ways and collide with the world, as is often the case with user-controlled characters. For game objects that don't require complex movement or collision detection, such as moving platforms, [AnimatableBody3D] is simpler to configure.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) ApplyFloorSnap ¶
func (self Instance) ApplyFloorSnap()
Allows to manually apply a snap to the floor regardless of the body's velocity. This function does nothing when [method is_on_floor] returns [code]true[/code].
func (Instance) AsCharacterBody3D ¶
func (Instance) AsCollisionObject3D ¶
func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
func (Instance) AsPhysicsBody3D ¶
func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
func (Instance) FloorBlockOnWall ¶
func (Instance) FloorConstantSpeed ¶
func (Instance) FloorMaxAngle ¶
func (Instance) FloorSnapLength ¶
func (Instance) FloorStopOnSlope ¶
func (Instance) GetFloorAngle ¶
Returns the floor's collision angle at the last collision point according to [param up_direction], which is [constant Vector3.UP] by default. This value is always positive and only valid after calling [method move_and_slide] and when [method is_on_floor] returns [code]true[/code].
func (Instance) GetFloorNormal ¶
Returns the collision normal of the floor at the last collision point. Only valid after calling [method move_and_slide] and when [method is_on_floor] returns [code]true[/code]. [b]Warning:[/b] The collision normal is not always the same as the surface normal.
func (Instance) GetLastMotion ¶
Returns the last motion applied to the [CharacterBody3D] during the last call to [method move_and_slide]. The movement can be split into multiple motions when sliding occurs, and this method return the last one, which is useful to retrieve the current direction of the movement.
func (Instance) GetLastSlideCollision ¶
func (self Instance) GetLastSlideCollision() [1]gdclass.KinematicCollision3D
Returns a [KinematicCollision3D], which contains information about the latest collision that occurred during the last call to [method move_and_slide].
func (Instance) GetPlatformAngularVelocity ¶
Returns the angular velocity of the platform at the last collision point. Only valid after calling [method move_and_slide].
func (Instance) GetPlatformVelocity ¶
Returns the linear velocity of the platform at the last collision point. Only valid after calling [method move_and_slide].
func (Instance) GetPositionDelta ¶
Returns the travel (position delta) that occurred during the last call to [method move_and_slide].
func (Instance) GetRealVelocity ¶
Returns the current real velocity since the last call to [method move_and_slide]. For example, when you climb a slope, you will move diagonally even though the velocity is horizontal. This method returns the diagonal movement, as opposed to [member velocity] which returns the requested velocity.
func (Instance) GetSlideCollision ¶
func (self Instance) GetSlideCollision(slide_idx int) [1]gdclass.KinematicCollision3D
Returns a [KinematicCollision3D], which contains information about a collision that occurred during the last call to [method move_and_slide]. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_collision_count] - 1).
func (Instance) GetSlideCollisionCount ¶
Returns the number of times the body collided and changed direction during the last call to [method move_and_slide].
func (Instance) GetWallNormal ¶
Returns the collision normal of the wall at the last collision point. Only valid after calling [method move_and_slide] and when [method is_on_wall] returns [code]true[/code]. [b]Warning:[/b] The collision normal is not always the same as the surface normal.
func (Instance) IsOnCeiling ¶
Returns [code]true[/code] if the body collided with the ceiling on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "ceiling" or not.
func (Instance) IsOnCeilingOnly ¶
Returns [code]true[/code] if the body collided only with the ceiling on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "ceiling" or not.
func (Instance) IsOnFloor ¶
Returns [code]true[/code] if the body collided with the floor on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "floor" or not.
func (Instance) IsOnFloorOnly ¶
Returns [code]true[/code] if the body collided only with the floor on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "floor" or not.
func (Instance) IsOnWall ¶
Returns [code]true[/code] if the body collided with a wall on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "wall" or not.
func (Instance) IsOnWallOnly ¶
Returns [code]true[/code] if the body collided only with a wall on the last call of [method move_and_slide]. Otherwise, returns [code]false[/code]. The [member up_direction] and [member floor_max_angle] are used to determine whether a surface is "wall" or not.
func (Instance) MotionMode ¶
func (self Instance) MotionMode() gdclass.CharacterBody3DMotionMode
func (Instance) MoveAndSlide ¶
Moves the body based on [member velocity]. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [CharacterBody3D] or [RigidBody3D], it will also be affected by the motion of the other body. You can use this to make moving and rotating platforms, or to make nodes push other nodes. Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more detailed information about collisions that occurred, use [method get_slide_collision]. When the body touches a moving platform, the platform's velocity is automatically added to the body motion. If a collision occurs due to the platform's motion, it will always be first in the slide collisions. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code].
func (Instance) PlatformFloorLayers ¶
func (Instance) PlatformOnLeave ¶
func (self Instance) PlatformOnLeave() gdclass.CharacterBody3DPlatformOnLeave
func (Instance) PlatformWallLayers ¶
func (Instance) SafeMargin ¶
func (Instance) SetFloorBlockOnWall ¶
func (Instance) SetFloorConstantSpeed ¶
func (Instance) SetFloorMaxAngle ¶
func (Instance) SetFloorSnapLength ¶
func (Instance) SetFloorStopOnSlope ¶
func (Instance) SetMaxSlides ¶
func (Instance) SetMotionMode ¶
func (self Instance) SetMotionMode(value gdclass.CharacterBody3DMotionMode)
func (Instance) SetPlatformFloorLayers ¶
func (Instance) SetPlatformOnLeave ¶
func (self Instance) SetPlatformOnLeave(value gdclass.CharacterBody3DPlatformOnLeave)
func (Instance) SetPlatformWallLayers ¶
func (Instance) SetSafeMargin ¶
func (Instance) SetSlideOnCeiling ¶
func (Instance) SetUpDirection ¶
func (Instance) SetVelocity ¶
func (Instance) SetWallMinSlideAngle ¶
func (Instance) SlideOnCeiling ¶
func (*Instance) UnsafePointer ¶
func (Instance) UpDirection ¶
func (Instance) WallMinSlideAngle ¶
type MotionMode ¶
type MotionMode = gdclass.CharacterBody3DMotionMode //gd:CharacterBody3D.MotionMode
const ( /*Apply when notions of walls, ceiling and floor are relevant. In this mode the body motion will react to slopes (acceleration/slowdown). This mode is suitable for grounded games like platformers.*/ MotionModeGrounded MotionMode = 0 /*Apply when there is no notion of floor or ceiling. All collisions will be reported as [code]on_wall[/code]. In this mode, when you slide, the speed will always be constant. This mode is suitable for games without ground like space games.*/ MotionModeFloating MotionMode = 1 )
type PlatformOnLeave ¶
type PlatformOnLeave = gdclass.CharacterBody3DPlatformOnLeave //gd:CharacterBody3D.PlatformOnLeave
const ( /*Add the last platform velocity to the [member velocity] when you leave a moving platform.*/ PlatformOnLeaveAddVelocity PlatformOnLeave = 0 /*Add the last platform velocity to the [member velocity] when you leave a moving platform, but any downward motion is ignored. It's useful to keep full jump height even when the platform is moving down.*/ PlatformOnLeaveAddUpwardVelocity PlatformOnLeave = 1 /*Do nothing when leaving a platform.*/ PlatformOnLeaveDoNothing PlatformOnLeave = 2 )