PhysicsServer3D

package
v0.0.0-...-0d6c339 Latest Latest
Warning

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

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

Documentation

Overview

PhysicsServer3D is the server responsible for all 3D physics. It can directly create and manipulate all physics objects:

- A space is a self-contained world for a physics simulation. It contains bodies, areas, and joints. Its state can be queried for collision and intersection information, and several parameters of the simulation can be modified.

- A shape is a geometric shape such as a sphere, a box, a cylinder, or a polygon. It can be used for collision detection by adding it to a body/area, possibly with an extra transformation relative to the body/area's origin. Bodies/areas can have multiple (transformed) shapes added to them, and a single shape can be added to bodies/areas multiple times with different local transformations.

- A body is a physical object which can be in static, kinematic, or rigid mode. Its state (such as position and velocity) can be queried and updated. A force integration callback can be set to customize the body's physics.

- An area is a region in space which can be used to detect bodies and areas entering and exiting it. A body monitoring callback can be set to report entering/exiting body shapes, and similarly an area monitoring callback can be set. Gravity and damping can be overridden within the area by setting area parameters.

- A joint is a constraint, either between two bodies or on one body relative to a point. Parameters such as the joint bias and the rest length of a spring joint can be adjusted.

Physics objects in graphics.gd/classdb/PhysicsServer3D may be created and manipulated independently; they do not have to be tied to nodes in the scene tree.

Note: All the 3D physics nodes use the physics server internally. Adding a physics node to the scene tree will cause a corresponding physics object to be created in the physics server. A rigid body node registers a callback that updates the node's transform with the transform of the respective body object in the physics server (every physics update). An area node registers a callback to inform the area node about overlaps with the respective area object in the physics server. The raycast node queries the direct state of the relevant space in the physics server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advanced

func Advanced() class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

func AreaAddShape

func AreaAddShape(area RID.Area3D, shape RID.Shape3D, disabled bool)

Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

func AreaAddShapeOptions

func AreaAddShapeOptions(area RID.Area3D, shape RID.Shape3D, transform Transform3D.BasisOrigin, disabled bool)

Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

func AreaAttachObjectInstanceId

func AreaAttachObjectInstanceId(area RID.Area3D, id int)

Assigns the area to a descendant of graphics.gd/classdb/Object, so it can exist in the node tree.

func AreaClearShapes

func AreaClearShapes(area RID.Area3D)

Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.

func AreaCreate

func AreaCreate() RID.Area3D

Creates a 3D area object in the physics server, and returns the [Resource.ID] that identifies it. The default settings for the created area include a collision layer and mask set to 1, and monitorable set to false.

Use AreaAddShape to add shapes to it, use AreaSetTransform to set its transform, and use AreaSetSpace to add the area to a space. If you want the area to be detectable use AreaSetMonitorable.

func AreaGetCollisionLayer

func AreaGetCollisionLayer(area RID.Area3D) int

Returns the physics layer or layers an area belongs to.

func AreaGetCollisionMask

func AreaGetCollisionMask(area RID.Area3D) int

Returns the physics layer or layers an area can contact with.

func AreaGetObjectInstanceId

func AreaGetObjectInstanceId(area RID.Area3D) int

Gets the instance ID of the object the area is assigned to.

func AreaGetParam

func AreaGetParam(area RID.Area3D, param AreaParameter) any

Returns an area parameter value. A list of available parameters is on the AreaParameter constants.

func AreaGetShape

func AreaGetShape(area RID.Area3D, shape_idx int) RID.Shape3D

Returns the [Resource.ID] of the nth shape of an area.

func AreaGetShapeCount

func AreaGetShapeCount(area RID.Area3D) int

Returns the number of shapes assigned to an area.

func AreaGetShapeTransform

func AreaGetShapeTransform(area RID.Area3D, shape_idx int) Transform3D.BasisOrigin

Returns the transform matrix of a shape within an area.

func AreaGetSpace

func AreaGetSpace(area RID.Area3D) RID.Space3D

Returns the space assigned to the area.

func AreaGetTransform

func AreaGetTransform(area RID.Area3D) Transform3D.BasisOrigin

Returns the transform matrix for an area.

func AreaRemoveShape

func AreaRemoveShape(area RID.Area3D, shape_idx int)

Removes a shape from an area. It does not delete the shape, so it can be reassigned later.

func AreaSetAreaMonitorCallback

func AreaSetAreaMonitorCallback(area RID.Area3D, callback func(status int, body_rid RID.Any, instance_id Object.ID, body_shape_idx int, self_shape_idx int))

Sets the area's area monitor callback. This callback will be called when any other (shape of an) area enters or exits (a shape of) the given area, and must take the following five parameters:

1. an integer status: either AreaBodyAdded or AreaBodyRemoved depending on whether the other area's shape entered or exited the area,

2. an [Resource.ID] area_rid: the [Resource.ID] of the other area that entered or exited the area,

3. an integer instance_id: the ObjectID attached to the other area,

4. an integer area_shape_idx: the index of the shape of the other area that entered or exited the area,

5. an integer self_shape_idx: the index of the shape of the area where the other area entered or exited.

By counting (or keeping track of) the shapes that enter and exit, it can be determined if an area (with all its shapes) is entering for the first time or exiting for the last time.

func AreaSetCollisionLayer

func AreaSetCollisionLayer(area RID.Area3D, layer int)

Assigns the area to one or many physics layers.

func AreaSetCollisionMask

func AreaSetCollisionMask(area RID.Area3D, mask int)

Sets which physics layers the area will monitor.

func AreaSetMonitorCallback

func AreaSetMonitorCallback(area RID.Area3D, callback func(status int, body_rid RID.Any, instance_id Object.ID, body_shape_idx int, self_shape_idx int))

Sets the area's body monitor callback. This callback will be called when any other (shape of a) body enters or exits (a shape of) the given area, and must take the following five parameters:

1. an integer status: either AreaBodyAdded or AreaBodyRemoved depending on whether the other body shape entered or exited the area,

2. an [Resource.ID] body_rid: the [Resource.ID] of the body that entered or exited the area,

3. an integer instance_id: the ObjectID attached to the body,

4. an integer body_shape_idx: the index of the shape of the body that entered or exited the area,

5. an integer self_shape_idx: the index of the shape of the area where the body entered or exited.

By counting (or keeping track of) the shapes that enter and exit, it can be determined if a body (with all its shapes) is entering for the first time or exiting for the last time.

func AreaSetMonitorable

func AreaSetMonitorable(area RID.Area3D, monitorable bool)

func AreaSetParam

func AreaSetParam(area RID.Area3D, param AreaParameter, value any)

Sets the value for an area parameter. A list of available parameters is on the AreaParameter constants.

func AreaSetRayPickable

func AreaSetRayPickable(area RID.Area3D, enable bool)

Sets object pickable with rays.

func AreaSetShape

func AreaSetShape(area RID.Area3D, shape_idx int, shape RID.Shape3D)

Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [Resource.ID].

func AreaSetShapeDisabled

func AreaSetShapeDisabled(area RID.Area3D, shape_idx int, disabled bool)

func AreaSetShapeTransform

func AreaSetShapeTransform(area RID.Area3D, shape_idx int, transform Transform3D.BasisOrigin)

Sets the transform matrix for an area shape.

func AreaSetSpace

func AreaSetSpace(area RID.Area3D, space RID.Space3D)

Assigns a space to the area.

func AreaSetTransform

func AreaSetTransform(area RID.Area3D, transform Transform3D.BasisOrigin)

Sets the transform matrix for an area.

func BodyAddCollisionException

func BodyAddCollisionException(body RID.Body3D, excepted_body RID.Body3D)

Adds a body to the list of bodies exempt from collisions.

func BodyAddConstantCentralForce

func BodyAddConstantCentralForce(body RID.Body3D, force Vector3.XYZ)

Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

This is equivalent to using BodyAddConstantForce at the body's center of mass.

func BodyAddConstantForce

func BodyAddConstantForce(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)

Adds a constant positioned force to the body that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

'position' is the offset from the body origin in global coordinates.

func BodyAddConstantForceOptions

func BodyAddConstantForceOptions(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)

Adds a constant positioned force to the body that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

'position' is the offset from the body origin in global coordinates.

func BodyAddConstantTorque

func BodyAddConstantTorque(body RID.Body3D, torque Vector3.XYZ)

Adds a constant rotational force without affecting position that keeps being applied over time until cleared with body_set_constant_torque(body, Vector3(0, 0, 0)).

func BodyAddShape

func BodyAddShape(body RID.Body3D, shape RID.Shape3D, disabled bool)

Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

func BodyAddShapeOptions

func BodyAddShapeOptions(body RID.Body3D, shape RID.Shape3D, transform Transform3D.BasisOrigin, disabled bool)

Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

func BodyApplyCentralForce

func BodyApplyCentralForce(body RID.Body3D, force Vector3.XYZ)

Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update.

This is equivalent to using BodyApplyForce at the body's center of mass.

func BodyApplyCentralImpulse

func BodyApplyCentralImpulse(body RID.Body3D, impulse Vector3.XYZ)

Applies a directional impulse without affecting rotation.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

This is equivalent to using BodyApplyImpulse at the body's center of mass.

func BodyApplyForce

func BodyApplyForce(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)

Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.

'position' is the offset from the body origin in global coordinates.

func BodyApplyForceOptions

func BodyApplyForceOptions(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)

Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.

'position' is the offset from the body origin in global coordinates.

func BodyApplyImpulse

func BodyApplyImpulse(body RID.Body3D, impulse Vector3.XYZ, position Vector3.XYZ)

Applies a positioned impulse to the body.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

'position' is the offset from the body origin in global coordinates.

func BodyApplyImpulseOptions

func BodyApplyImpulseOptions(body RID.Body3D, impulse Vector3.XYZ, position Vector3.XYZ)

Applies a positioned impulse to the body.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

'position' is the offset from the body origin in global coordinates.

func BodyApplyTorque

func BodyApplyTorque(body RID.Body3D, torque Vector3.XYZ)

Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.

func BodyApplyTorqueImpulse

func BodyApplyTorqueImpulse(body RID.Body3D, impulse Vector3.XYZ)

Applies a rotational impulse to the body without affecting the position.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

func BodyAttachObjectInstanceId

func BodyAttachObjectInstanceId(body RID.Body3D, id int)

Assigns the area to a descendant of graphics.gd/classdb/Object, so it can exist in the node tree.

func BodyClearShapes

func BodyClearShapes(body RID.Body3D)

Removes all shapes from a body.

func BodyCreate

func BodyCreate() RID.Body3D

Creates a 3D body object in the physics server, and returns the [Resource.ID] that identifies it. The default settings for the created area include a collision layer and mask set to 1, and body mode set to BodyModeRigid.

Use BodyAddShape to add shapes to it, use BodySetState to set its transform, and use BodySetSpace to add the body to a space.

func BodyGetCollisionLayer

func BodyGetCollisionLayer(body RID.Body3D) int

Returns the physics layer or layers a body belongs to.

func BodyGetCollisionMask

func BodyGetCollisionMask(body RID.Body3D) int

Returns the physics layer or layers a body can collide with.

func BodyGetCollisionPriority

func BodyGetCollisionPriority(body RID.Body3D) Float.X

Returns the body's collision priority.

func BodyGetConstantForce

func BodyGetConstantForce(body RID.Body3D) Vector3.XYZ

Returns the body's total constant positional forces applied during each physics update.

See BodyAddConstantForce and BodyAddConstantCentralForce.

func BodyGetConstantTorque

func BodyGetConstantTorque(body RID.Body3D) Vector3.XYZ

Returns the body's total constant rotational forces applied during each physics update.

See BodyAddConstantTorque.

func BodyGetDirectState

func BodyGetDirectState(body RID.Body3D) PhysicsDirectBodyState3D.Instance

Returns the graphics.gd/classdb/PhysicsDirectBodyState3D of the body. Returns null if the body is destroyed or removed from the physics space.

func BodyGetMaxContactsReported

func BodyGetMaxContactsReported(body RID.Body3D) int

Returns the maximum contacts that can be reported. See BodySetMaxContactsReported.

func BodyGetObjectInstanceId

func BodyGetObjectInstanceId(body RID.Body3D) int

Gets the instance ID of the object the area is assigned to.

func BodyGetParam

func BodyGetParam(body RID.Body3D, param BodyParameter) any

Returns the value of a body parameter. A list of available parameters is on the BodyParameter constants.

func BodyGetShape

func BodyGetShape(body RID.Body3D, shape_idx int) RID.Shape3D

Returns the [Resource.ID] of the nth shape of a body.

func BodyGetShapeCount

func BodyGetShapeCount(body RID.Body3D) int

Returns the number of shapes assigned to a body.

func BodyGetShapeTransform

func BodyGetShapeTransform(body RID.Body3D, shape_idx int) Transform3D.BasisOrigin

Returns the transform matrix of a body shape.

func BodyGetSpace

func BodyGetSpace(body RID.Body3D) RID.Space3D

Returns the [Resource.ID] of the space assigned to a body.

func BodyGetState

func BodyGetState(body RID.Body3D, state BodyState) any

Returns a body state.

func BodyIsAxisLocked

func BodyIsAxisLocked(body RID.Body3D, axis BodyAxis) bool

func BodyIsContinuousCollisionDetectionEnabled

func BodyIsContinuousCollisionDetectionEnabled(body RID.Body3D) bool

If true, the continuous collision detection mode is enabled.

func BodyIsOmittingForceIntegration

func BodyIsOmittingForceIntegration(body RID.Body3D) bool

Returns true if the body is omitting the standard force integration. See BodySetOmitForceIntegration.

func BodyRemoveCollisionException

func BodyRemoveCollisionException(body RID.Body3D, excepted_body RID.Body3D)

Removes a body from the list of bodies exempt from collisions.

Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.

func BodyRemoveShape

func BodyRemoveShape(body RID.Body3D, shape_idx int)

Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.

func BodyResetMassProperties

func BodyResetMassProperties(body RID.Body3D)

Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using BodySetParam.

func BodySetAxisLock

func BodySetAxisLock(body RID.Body3D, axis BodyAxis, lock bool)

func BodySetAxisVelocity

func BodySetAxisVelocity(body RID.Body3D, axis_velocity Vector3.XYZ)

Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.

func BodySetCollisionLayer

func BodySetCollisionLayer(body RID.Body3D, layer int)

Sets the physics layer or layers a body belongs to.

func BodySetCollisionMask

func BodySetCollisionMask(body RID.Body3D, mask int)

Sets the physics layer or layers a body can collide with.

func BodySetCollisionPriority

func BodySetCollisionPriority(body RID.Body3D, priority Float.X)

Sets the body's collision priority.

func BodySetConstantForce

func BodySetConstantForce(body RID.Body3D, force Vector3.XYZ)

Sets the body's total constant positional forces applied during each physics update.

See BodyAddConstantForce and BodyAddConstantCentralForce.

func BodySetConstantTorque

func BodySetConstantTorque(body RID.Body3D, torque Vector3.XYZ)

Sets the body's total constant rotational forces applied during each physics update.

See BodyAddConstantTorque.

func BodySetEnableContinuousCollisionDetection

func BodySetEnableContinuousCollisionDetection(body RID.Body3D, enable bool)

If true, the continuous collision detection mode is enabled.

Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.

func BodySetForceIntegrationCallback

func BodySetForceIntegrationCallback(body RID.Body3D, callable func(state PhysicsDirectBodyState3D.Instance, userdata any), userdata any)

Sets the body's custom force integration callback function to 'callable'. Use an empty func (Callable()) to clear the custom callback.

The function 'callable' will be called every physics tick, before the standard force integration (see BodySetOmitForceIntegration). It can be used for example to update the body's linear and angular velocity based on contact with other bodies.

If 'userdata' is not null, the function 'callable' must take the following two parameters:

1. state: a graphics.gd/classdb/PhysicsDirectBodyState3D, used to retrieve and modify the body's state,

2. userdata: a any; its value will be the 'userdata' passed into this method.

If 'userdata' is null, then 'callable' must take only the state parameter.

func BodySetForceIntegrationCallbackOptions

func BodySetForceIntegrationCallbackOptions(body RID.Body3D, callable func(state PhysicsDirectBodyState3D.Instance, userdata any), userdata any)

Sets the body's custom force integration callback function to 'callable'. Use an empty func (Callable()) to clear the custom callback.

The function 'callable' will be called every physics tick, before the standard force integration (see BodySetOmitForceIntegration). It can be used for example to update the body's linear and angular velocity based on contact with other bodies.

If 'userdata' is not null, the function 'callable' must take the following two parameters:

1. state: a graphics.gd/classdb/PhysicsDirectBodyState3D, used to retrieve and modify the body's state,

2. userdata: a any; its value will be the 'userdata' passed into this method.

If 'userdata' is null, then 'callable' must take only the state parameter.

func BodySetMaxContactsReported

func BodySetMaxContactsReported(body RID.Body3D, amount int)

Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies. This is enabled by setting the maximum number of contacts reported to a number greater than 0.

func BodySetMode

func BodySetMode(body RID.Body3D, mode BodyMode)

Sets the body mode.

func BodySetOmitForceIntegration

func BodySetOmitForceIntegration(body RID.Body3D, enable bool)

Sets whether the body omits the standard force integration. If 'enable' is true, the body will not automatically use applied forces, torques, and damping to update the body's linear and angular velocity. In this case, BodySetForceIntegrationCallback can be used to manually update the linear and angular velocity instead.

This method is called when the property graphics.gd/classdb/RigidBody3D.Instance.CustomIntegrator is set.

func BodySetParam

func BodySetParam(body RID.Body3D, param BodyParameter, value any)

Sets a body parameter. A list of available parameters is on the BodyParameter constants.

func BodySetRayPickable

func BodySetRayPickable(body RID.Body3D, enable bool)

Sets the body pickable with rays if 'enable' is set.

func BodySetShape

func BodySetShape(body RID.Body3D, shape_idx int, shape RID.Shape3D)

Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [Resource.ID].

func BodySetShapeDisabled

func BodySetShapeDisabled(body RID.Body3D, shape_idx int, disabled bool)

func BodySetShapeTransform

func BodySetShapeTransform(body RID.Body3D, shape_idx int, transform Transform3D.BasisOrigin)

Sets the transform matrix for a body shape.

func BodySetSpace

func BodySetSpace(body RID.Body3D, space RID.Space3D)

Assigns a space to the body (see SpaceCreate).

func BodySetState

func BodySetState(body RID.Body3D, state BodyState, value any)

Sets a body state.

func BodySetStateSyncCallback

func BodySetStateSyncCallback(body RID.Body3D, callable func(state PhysicsDirectBodyState3D.Instance))

Sets the body's state synchronization callback function to 'callable'. Use an empty func (Callable()) to clear the callback.

The function 'callable' will be called every physics frame, assuming that the body was active during the previous physics tick, and can be used to fetch the latest state from the physics server.

The function 'callable' must take the following parameters:

1. state: a graphics.gd/classdb/PhysicsDirectBodyState3D, used to retrieve the body's state.

func BodyTestMotion

Returns true if a collision would result from moving along a motion vector from a given point in space. graphics.gd/classdb/PhysicsTestMotionParameters3D is passed to set motion parameters. graphics.gd/classdb/PhysicsTestMotionResult3D can be passed to return additional information.

func BodyTestMotionOptions

func BodyTestMotionOptions(body RID.Body3D, parameters PhysicsTestMotionParameters3D.Instance, result PhysicsTestMotionResult3D.Instance) bool

Returns true if a collision would result from moving along a motion vector from a given point in space. graphics.gd/classdb/PhysicsTestMotionParameters3D is passed to set motion parameters. graphics.gd/classdb/PhysicsTestMotionResult3D can be passed to return additional information.

func BoxShapeCreate

func BoxShapeCreate() RID.Shape3D

func CapsuleShapeCreate

func CapsuleShapeCreate() RID.Shape3D

func ConcavePolygonShapeCreate

func ConcavePolygonShapeCreate() RID.Shape3D

func ConeTwistJointGetParam

func ConeTwistJointGetParam(joint RID.Joint3D, param ConeTwistJointParam) Float.X

Gets a cone twist joint parameter.

func ConeTwistJointSetParam

func ConeTwistJointSetParam(joint RID.Joint3D, param ConeTwistJointParam, value Float.X)

Sets a cone twist joint parameter.

func ConvexPolygonShapeCreate

func ConvexPolygonShapeCreate() RID.Shape3D

func CustomShapeCreate

func CustomShapeCreate() RID.Shape3D

func CylinderShapeCreate

func CylinderShapeCreate() RID.Shape3D

func FreeRid

func FreeRid(rid RID.Any)

Destroys any of the objects created by PhysicsServer3D. If the [Resource.ID] passed is not one of the objects that can be created by PhysicsServer3D, an error will be sent to the console.

func Generic6dofJointGetFlag

func Generic6dofJointGetFlag(joint RID.Joint3D, axis Vector3.Axis, flag G6DOFJointAxisFlag) bool

Returns the value of a generic 6DOF joint flag.

func Generic6dofJointGetParam

func Generic6dofJointGetParam(joint RID.Joint3D, axis Vector3.Axis, param G6DOFJointAxisParam) Float.X

Returns the value of a generic 6DOF joint parameter.

func Generic6dofJointSetFlag

func Generic6dofJointSetFlag(joint RID.Joint3D, axis Vector3.Axis, flag G6DOFJointAxisFlag, enable bool)

Sets the value of a given generic 6DOF joint flag.

func Generic6dofJointSetParam

func Generic6dofJointSetParam(joint RID.Joint3D, axis Vector3.Axis, param G6DOFJointAxisParam, value Float.X)

Sets the value of a given generic 6DOF joint parameter.

func GetProcessInfo

func GetProcessInfo(process_info ProcessInfo) int

Returns the value of a physics engine state specified by 'process_info'.

func HeightmapShapeCreate

func HeightmapShapeCreate() RID.Shape3D

func HingeJointGetFlag

func HingeJointGetFlag(joint RID.Joint3D, flag HingeJointFlag) bool

Gets a hinge joint flag.

func HingeJointGetParam

func HingeJointGetParam(joint RID.Joint3D, param HingeJointParam) Float.X

Gets a hinge joint parameter.

func HingeJointSetFlag

func HingeJointSetFlag(joint RID.Joint3D, flag HingeJointFlag, enabled bool)

Sets a hinge joint flag.

func HingeJointSetParam

func HingeJointSetParam(joint RID.Joint3D, param HingeJointParam, value Float.X)

Sets a hinge joint parameter.

func JointClear

func JointClear(joint RID.Joint3D)

func JointCreate

func JointCreate() RID.Joint3D

func JointDisableCollisionsBetweenBodies

func JointDisableCollisionsBetweenBodies(joint RID.Joint3D, disable bool)

Sets whether the bodies attached to the graphics.gd/classdb/Joint3D will collide with each other.

func JointGetSolverPriority

func JointGetSolverPriority(joint RID.Joint3D) int

Gets the priority value of the Joint3D.

func JointIsDisabledCollisionsBetweenBodies

func JointIsDisabledCollisionsBetweenBodies(joint RID.Joint3D) bool

Returns whether the bodies attached to the graphics.gd/classdb/Joint3D will collide with each other.

func JointMakeConeTwist

func JointMakeConeTwist(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, body_B RID.Body3D, local_ref_B Transform3D.BasisOrigin)

func JointMakeGeneric6dof

func JointMakeGeneric6dof(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, body_B RID.Body3D, local_ref_B Transform3D.BasisOrigin)

Make the joint a generic six degrees of freedom (6DOF) joint. Use Generic6dofJointSetFlag and Generic6dofJointSetParam to set the joint's flags and parameters respectively.

func JointMakeHinge

func JointMakeHinge(joint RID.Joint3D, body_A RID.Body3D, hinge_A Transform3D.BasisOrigin, body_B RID.Body3D, hinge_B Transform3D.BasisOrigin)

func JointMakePin

func JointMakePin(joint RID.Joint3D, body_A RID.Body3D, local_A Vector3.XYZ, body_B RID.Body3D, local_B Vector3.XYZ)

func JointMakeSlider

func JointMakeSlider(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, body_B RID.Body3D, local_ref_B Transform3D.BasisOrigin)

func JointSetSolverPriority

func JointSetSolverPriority(joint RID.Joint3D, priority int)

Sets the priority value of the Joint3D.

func PinJointGetLocalA

func PinJointGetLocalA(joint RID.Joint3D) Vector3.XYZ

Returns position of the joint in the local space of body a of the joint.

func PinJointGetLocalB

func PinJointGetLocalB(joint RID.Joint3D) Vector3.XYZ

Returns position of the joint in the local space of body b of the joint.

func PinJointGetParam

func PinJointGetParam(joint RID.Joint3D, param PinJointParam) Float.X

Gets a pin joint parameter.

func PinJointSetLocalA

func PinJointSetLocalA(joint RID.Joint3D, local_A Vector3.XYZ)

Sets position of the joint in the local space of body a of the joint.

func PinJointSetLocalB

func PinJointSetLocalB(joint RID.Joint3D, local_B Vector3.XYZ)

Sets position of the joint in the local space of body b of the joint.

func PinJointSetParam

func PinJointSetParam(joint RID.Joint3D, param PinJointParam, value Float.X)

Sets a pin joint parameter.

func SeparationRayShapeCreate

func SeparationRayShapeCreate() RID.Shape3D

func SetActive

func SetActive(active bool)

Activates or deactivates the 3D physics engine.

func ShapeGetData

func ShapeGetData(shape RID.Shape3D) any

Returns the shape data.

func ShapeGetMargin

func ShapeGetMargin(shape RID.Shape3D) Float.X

Returns the collision margin for the shape.

Note: This is not used in Godot Physics, so will always return 0.

func ShapeSetData

func ShapeSetData(shape RID.Shape3D, data any)

Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created ShapeGetType.

func ShapeSetMargin

func ShapeSetMargin(shape RID.Shape3D, margin Float.X)

Sets the collision margin for the shape.

Note: This is not used in Godot Physics.

func SliderJointGetParam

func SliderJointGetParam(joint RID.Joint3D, param SliderJointParam) Float.X

Gets a slider joint parameter.

func SliderJointSetParam

func SliderJointSetParam(joint RID.Joint3D, param SliderJointParam, value Float.X)

Gets a slider joint parameter.

func SoftBodyAddCollisionException

func SoftBodyAddCollisionException(body RID.SoftBody3D, body_b RID.Body3D)

Adds the given body to the list of bodies exempt from collisions.

func SoftBodyApplyCentralForce

func SoftBodyApplyCentralForce(body RID.Body2D, force Vector3.XYZ)

Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.

func SoftBodyApplyCentralImpulse

func SoftBodyApplyCentralImpulse(body RID.Body2D, impulse Vector3.XYZ)

Distributes and applies an impulse to all points.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

func SoftBodyApplyPointForce

func SoftBodyApplyPointForce(body RID.Body2D, point_index int, force Vector3.XYZ)

Applies a force to a point. A force is time dependent and meant to be applied every physics update.

func SoftBodyApplyPointImpulse

func SoftBodyApplyPointImpulse(body RID.Body2D, point_index int, impulse Vector3.XYZ)

Applies an impulse to a point.

An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

func SoftBodyCreate

func SoftBodyCreate() RID.SoftBody3D

Creates a new soft body and returns its internal [Resource.ID].

func SoftBodyGetBounds

func SoftBodyGetBounds(body RID.SoftBody3D) AABB.PositionSize

Returns the bounds of the given soft body in global coordinates.

func SoftBodyGetCollisionLayer

func SoftBodyGetCollisionLayer(body RID.SoftBody3D) int

Returns the physics layer or layers that the given soft body belongs to.

func SoftBodyGetCollisionMask

func SoftBodyGetCollisionMask(body RID.SoftBody3D) int

Returns the physics layer or layers that the given soft body can collide with.

func SoftBodyGetDampingCoefficient

func SoftBodyGetDampingCoefficient(body RID.SoftBody3D) Float.X

Returns the damping coefficient of the given soft body.

func SoftBodyGetDragCoefficient

func SoftBodyGetDragCoefficient(body RID.SoftBody3D) Float.X

Returns the drag coefficient of the given soft body.

func SoftBodyGetLinearStiffness

func SoftBodyGetLinearStiffness(body RID.SoftBody3D) Float.X

Returns the linear stiffness of the given soft body.

func SoftBodyGetPointGlobalPosition

func SoftBodyGetPointGlobalPosition(body RID.SoftBody3D, point_index int) Vector3.XYZ

Returns the current position of the given soft body point in global coordinates.

func SoftBodyGetPressureCoefficient

func SoftBodyGetPressureCoefficient(body RID.SoftBody3D) Float.X

Returns the pressure coefficient of the given soft body.

func SoftBodyGetShrinkingFactor

func SoftBodyGetShrinkingFactor(body RID.Body2D) Float.X

Returns the shrinking factor of the given soft body.

func SoftBodyGetSimulationPrecision

func SoftBodyGetSimulationPrecision(body RID.SoftBody3D) int

Returns the simulation precision of the given soft body.

func SoftBodyGetSpace

func SoftBodyGetSpace(body RID.SoftBody3D) RID.Space3D

Returns the [Resource.ID] of the space assigned to the given soft body.

func SoftBodyGetState

func SoftBodyGetState(body RID.SoftBody3D, state BodyState) any

Returns the given soft body state.

Note: Godot's default physics implementation does not support BodyStateLinearVelocity, BodyStateAngularVelocity, BodyStateSleeping, or BodyStateCanSleep.

func SoftBodyGetTotalMass

func SoftBodyGetTotalMass(body RID.SoftBody3D) Float.X

Returns the total mass assigned to the given soft body.

func SoftBodyIsPointPinned

func SoftBodyIsPointPinned(body RID.SoftBody3D, point_index int) bool

Returns whether the given soft body point is pinned.

func SoftBodyMovePoint

func SoftBodyMovePoint(body RID.SoftBody3D, point_index int, global_position Vector3.XYZ)

Moves the given soft body point to a position in global coordinates.

func SoftBodyPinPoint

func SoftBodyPinPoint(body RID.SoftBody3D, point_index int, pin bool)

Pins or unpins the given soft body point based on the value of 'pin'.

Note: Pinning a point effectively makes it kinematic, preventing it from being affected by forces, but you can still move it using SoftBodyMovePoint.

func SoftBodyRemoveAllPinnedPoints

func SoftBodyRemoveAllPinnedPoints(body RID.SoftBody3D)

Unpins all points of the given soft body.

func SoftBodyRemoveCollisionException

func SoftBodyRemoveCollisionException(body RID.SoftBody3D, body_b RID.Body3D)

Removes the given body from the list of bodies exempt from collisions.

func SoftBodySetCollisionLayer

func SoftBodySetCollisionLayer(body RID.SoftBody3D, layer int)

Sets the physics layer or layers the given soft body belongs to.

func SoftBodySetCollisionMask

func SoftBodySetCollisionMask(body RID.SoftBody3D, mask int)

Sets the physics layer or layers the given soft body can collide with.

func SoftBodySetDampingCoefficient

func SoftBodySetDampingCoefficient(body RID.SoftBody3D, damping_coefficient Float.X)

Sets the damping coefficient of the given soft body. Higher values will slow down the body more noticeably when forces are applied.

func SoftBodySetDragCoefficient

func SoftBodySetDragCoefficient(body RID.SoftBody3D, drag_coefficient Float.X)

Sets the drag coefficient of the given soft body. Higher values increase this body's air resistance.

Note: This value is currently unused by Godot's default physics implementation.

func SoftBodySetLinearStiffness

func SoftBodySetLinearStiffness(body RID.SoftBody3D, stiffness Float.X)

Sets the linear stiffness of the given soft body. Higher values will result in a stiffer body, while lower values will increase the body's ability to bend. The value can be between 0.0 and 1.0 (inclusive).

func SoftBodySetMesh

func SoftBodySetMesh(body RID.SoftBody3D, mesh RID.Mesh)

Sets the mesh of the given soft body.

func SoftBodySetPressureCoefficient

func SoftBodySetPressureCoefficient(body RID.SoftBody3D, pressure_coefficient Float.X)

Sets the pressure coefficient of the given soft body. Simulates pressure build-up from inside this body. Higher values increase the strength of this effect.

func SoftBodySetRayPickable

func SoftBodySetRayPickable(body RID.SoftBody3D, enable bool)

Sets whether the given soft body will be pickable when using object picking.

func SoftBodySetShrinkingFactor

func SoftBodySetShrinkingFactor(body RID.Body2D, shrinking_factor Float.X)

Sets the shrinking factor of the given soft body.

func SoftBodySetSimulationPrecision

func SoftBodySetSimulationPrecision(body RID.SoftBody3D, simulation_precision int)

Sets the simulation precision of the given soft body. Increasing this value will improve the resulting simulation, but can affect performance. Use with care.

func SoftBodySetSpace

func SoftBodySetSpace(body RID.SoftBody3D, space RID.Space3D)

Assigns a space to the given soft body (see SpaceCreate).

func SoftBodySetState

func SoftBodySetState(body RID.SoftBody3D, state BodyState, v any)

Sets the given body state for the given body.

Note: Godot's default physics implementation does not support BodyStateLinearVelocity, BodyStateAngularVelocity, BodyStateSleeping, or BodyStateCanSleep.

func SoftBodySetTotalMass

func SoftBodySetTotalMass(body RID.SoftBody3D, total_mass Float.X)

Sets the total mass for the given soft body.

func SoftBodySetTransform

func SoftBodySetTransform(body RID.SoftBody3D, transform Transform3D.BasisOrigin)

Sets the global transform of the given soft body.

func SoftBodyUpdateRenderingServer

func SoftBodyUpdateRenderingServer(body RID.SoftBody3D, rendering_server_handler PhysicsServer3DRenderingServerHandler.Instance)

Requests that the physics server updates the rendering server with the latest positions of the given soft body's points through the 'rendering_server_handler' interface.

func SpaceCreate

func SpaceCreate() RID.Space3D

Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with AreaSetSpace, or to a body with BodySetSpace.

func SpaceGetDirectState

func SpaceGetDirectState(space RID.Space3D) PhysicsDirectSpaceState3D.Instance

Returns the state of a space, a graphics.gd/classdb/PhysicsDirectSpaceState3D. This object can be used to make collision/intersection queries.

func SpaceGetParam

func SpaceGetParam(space RID.Space3D, param SpaceParameter) Float.X

Returns the value of a space parameter.

func SpaceIsActive

func SpaceIsActive(space RID.Space3D) bool

Returns whether the space is active.

func SpaceSetActive

func SpaceSetActive(space RID.Space3D, active bool)

Marks a space as active. It will not have an effect, unless it is assigned to an area or body.

func SpaceSetParam

func SpaceSetParam(space RID.Space3D, param SpaceParameter, value Float.X)

Sets the value for a space parameter. A list of available parameters is on the SpaceParameter constants.

func SphereShapeCreate

func SphereShapeCreate() RID.Shape3D

func WorldBoundaryShapeCreate

func WorldBoundaryShapeCreate() RID.Shape3D

Types

type AreaBodyStatus

type AreaBodyStatus int //gd:PhysicsServer3D.AreaBodyStatus
const (
	// The value of the first parameter and area callback function receives, when an object enters one of its shapes.
	AreaBodyAdded AreaBodyStatus = 0
	// The value of the first parameter and area callback function receives, when an object exits one of its shapes.
	AreaBodyRemoved AreaBodyStatus = 1
)

type AreaParameter

type AreaParameter int //gd:PhysicsServer3D.AreaParameter
const (
	// Constant to set/get gravity override mode in an area. See [AreaSpaceOverrideMode] for possible values.
	AreaParamGravityOverrideMode AreaParameter = 0
	// Constant to set/get gravity strength in an area.
	AreaParamGravity AreaParameter = 1
	// Constant to set/get gravity vector/center in an area.
	AreaParamGravityVector AreaParameter = 2
	// Constant to set/get whether the gravity vector of an area is a direction, or a center point.
	AreaParamGravityIsPoint AreaParameter = 3
	// Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [AreaParamGravity]. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on.
	//
	// The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance.
	AreaParamGravityPointUnitDistance AreaParameter = 4
	// Constant to set/get linear damping override mode in an area. See [AreaSpaceOverrideMode] for possible values.
	AreaParamLinearDampOverrideMode AreaParameter = 5
	// Constant to set/get the linear damping factor of an area.
	AreaParamLinearDamp AreaParameter = 6
	// Constant to set/get angular damping override mode in an area. See [AreaSpaceOverrideMode] for possible values.
	AreaParamAngularDampOverrideMode AreaParameter = 7
	// Constant to set/get the angular damping factor of an area.
	AreaParamAngularDamp AreaParameter = 8
	// Constant to set/get the priority (order of processing) of an area.
	AreaParamPriority AreaParameter = 9
	// Constant to set/get the magnitude of area-specific wind force. This wind force only applies to [graphics.gd/classdb/SoftBody3D] nodes. Other physics bodies are currently not affected by wind.
	AreaParamWindForceMagnitude AreaParameter = 10
	// Constant to set/get the 3D vector that specifies the origin from which an area-specific wind blows.
	AreaParamWindSource AreaParameter = 11
	// Constant to set/get the 3D vector that specifies the direction in which an area-specific wind blows.
	AreaParamWindDirection AreaParameter = 12
	// Constant to set/get the exponential rate at which wind force decreases with distance from its origin.
	AreaParamWindAttenuationFactor AreaParameter = 13
)

type AreaSpaceOverrideMode

type AreaSpaceOverrideMode int //gd:PhysicsServer3D.AreaSpaceOverrideMode
const (
	// This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them.
	AreaSpaceOverrideDisabled AreaSpaceOverrideMode = 0
	// This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
	AreaSpaceOverrideCombine AreaSpaceOverrideMode = 1
	// This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
	AreaSpaceOverrideCombineReplace AreaSpaceOverrideMode = 2
	// This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
	AreaSpaceOverrideReplace AreaSpaceOverrideMode = 3
	// This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
	AreaSpaceOverrideReplaceCombine AreaSpaceOverrideMode = 4
)

type BodyAxis

type BodyAxis int //gd:PhysicsServer3D.BodyAxis
const (
	BodyAxisLinearX  BodyAxis = 1
	BodyAxisLinearY  BodyAxis = 2
	BodyAxisLinearZ  BodyAxis = 4
	BodyAxisAngularX BodyAxis = 8
	BodyAxisAngularY BodyAxis = 16
	BodyAxisAngularZ BodyAxis = 32
)

type BodyDampMode

type BodyDampMode int //gd:PhysicsServer3D.BodyDampMode
const (
	// The body's damping value is added to any value set in areas or the default value.
	BodyDampModeCombine BodyDampMode = 0
	// The body's damping value replaces any value set in areas or the default value.
	BodyDampModeReplace BodyDampMode = 1
)

type BodyMode

type BodyMode int //gd:PhysicsServer3D.BodyMode
const (
	// Constant for static bodies. In this mode, a body can be only moved by user code and doesn't collide with other bodies along its path when moved.
	BodyModeStatic BodyMode = 0
	// Constant for kinematic bodies. In this mode, a body can be only moved by user code and collides with other bodies along its path.
	BodyModeKinematic BodyMode = 1
	// Constant for rigid bodies. In this mode, a body can be pushed by other bodies and has forces applied.
	BodyModeRigid BodyMode = 2
	// Constant for linear rigid bodies. In this mode, a body can not rotate, and only its linear velocity is affected by external forces.
	BodyModeRigidLinear BodyMode = 3
)

func BodyGetMode

func BodyGetMode(body RID.Body3D) BodyMode

Returns the body mode.

type BodyParameter

type BodyParameter int //gd:PhysicsServer3D.BodyParameter
const (
	// Constant to set/get a body's bounce factor.
	BodyParamBounce BodyParameter = 0
	// Constant to set/get a body's friction.
	BodyParamFriction BodyParameter = 1
	// Constant to set/get a body's mass.
	BodyParamMass BodyParameter = 2
	// Constant to set/get a body's inertia.
	BodyParamInertia BodyParameter = 3
	// Constant to set/get a body's center of mass position in the body's local coordinate system.
	BodyParamCenterOfMass BodyParameter = 4
	// Constant to set/get a body's gravity multiplier.
	BodyParamGravityScale BodyParameter = 5
	// Constant to set/get a body's linear damping mode. See [BodyDampMode] for possible values.
	BodyParamLinearDampMode BodyParameter = 6
	// Constant to set/get a body's angular damping mode. See [BodyDampMode] for possible values.
	BodyParamAngularDampMode BodyParameter = 7
	// Constant to set/get a body's linear damping factor.
	BodyParamLinearDamp BodyParameter = 8
	// Constant to set/get a body's angular damping factor.
	BodyParamAngularDamp BodyParameter = 9
	// Represents the size of the [BodyParameter] enum.
	BodyParamMax BodyParameter = 10
)

type BodyState

type BodyState int //gd:PhysicsServer3D.BodyState
const (
	// Constant to set/get the current transform matrix of the body.
	BodyStateTransform BodyState = 0
	// Constant to set/get the current linear velocity of the body.
	BodyStateLinearVelocity BodyState = 1
	// Constant to set/get the current angular velocity of the body.
	BodyStateAngularVelocity BodyState = 2
	// Constant to sleep/wake up a body, or to get whether it is sleeping.
	BodyStateSleeping BodyState = 3
	// Constant to set/get whether the body can sleep.
	BodyStateCanSleep BodyState = 4
)

type ConeTwistJointParam

type ConeTwistJointParam int //gd:PhysicsServer3D.ConeTwistJointParam
const (
	// Swing is rotation from side to side, around the axis perpendicular to the twist axis.
	//
	// The swing span defines, how much rotation will not get corrected along the swing axis.
	//
	// Could be defined as looseness in the [graphics.gd/classdb/ConeTwistJoint3D].
	//
	// If below 0.05, this behavior is locked.
	ConeTwistJointSwingSpan ConeTwistJointParam = 0
	// Twist is the rotation around the twist axis, this value defined how far the joint can twist.
	//
	// Twist is locked if below 0.05.
	ConeTwistJointTwistSpan ConeTwistJointParam = 1
	// The speed with which the swing or twist will take place.
	//
	// The higher, the faster.
	ConeTwistJointBias ConeTwistJointParam = 2
	// The ease with which the Joint3D twists, if it's too low, it takes more force to twist the joint.
	ConeTwistJointSoftness ConeTwistJointParam = 3
	// Defines, how fast the swing- and twist-speed-difference on both sides gets synced.
	ConeTwistJointRelaxation ConeTwistJointParam = 4
)

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

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

type G6DOFJointAxisFlag

type G6DOFJointAxisFlag int //gd:PhysicsServer3D.G6DOFJointAxisFlag
const (
	// If set, linear motion is possible within the given limits.
	G6dofJointFlagEnableLinearLimit G6DOFJointAxisFlag = 0
	// If set, rotational motion is possible.
	G6dofJointFlagEnableAngularLimit  G6DOFJointAxisFlag = 1
	G6dofJointFlagEnableAngularSpring G6DOFJointAxisFlag = 2
	G6dofJointFlagEnableLinearSpring  G6DOFJointAxisFlag = 3
	// If set, there is a rotational motor across these axes.
	G6dofJointFlagEnableMotor G6DOFJointAxisFlag = 4
	// If set, there is a linear motor on this axis that targets a specific velocity.
	G6dofJointFlagEnableLinearMotor G6DOFJointAxisFlag = 5
	// Represents the size of the [G6DOFJointAxisFlag] enum.
	G6dofJointFlagMax G6DOFJointAxisFlag = 6
)

type G6DOFJointAxisParam

type G6DOFJointAxisParam int //gd:PhysicsServer3D.G6DOFJointAxisParam
const (
	// The minimum difference between the pivot points' axes.
	G6dofJointLinearLowerLimit G6DOFJointAxisParam = 0
	// The maximum difference between the pivot points' axes.
	G6dofJointLinearUpperLimit G6DOFJointAxisParam = 1
	// A factor that gets applied to the movement across the axes. The lower, the slower the movement.
	G6dofJointLinearLimitSoftness G6DOFJointAxisParam = 2
	// The amount of restitution on the axes movement. The lower, the more velocity-energy gets lost.
	G6dofJointLinearRestitution G6DOFJointAxisParam = 3
	// The amount of damping that happens at the linear motion across the axes.
	G6dofJointLinearDamping G6DOFJointAxisParam = 4
	// The velocity that the joint's linear motor will attempt to reach.
	G6dofJointLinearMotorTargetVelocity G6DOFJointAxisParam = 5
	// The maximum force that the linear motor can apply while trying to reach the target velocity.
	G6dofJointLinearMotorForceLimit        G6DOFJointAxisParam = 6
	G6dofJointLinearSpringStiffness        G6DOFJointAxisParam = 7
	G6dofJointLinearSpringDamping          G6DOFJointAxisParam = 8
	G6dofJointLinearSpringEquilibriumPoint G6DOFJointAxisParam = 9
	// The minimum rotation in negative direction to break loose and rotate around the axes.
	G6dofJointAngularLowerLimit G6DOFJointAxisParam = 10
	// The minimum rotation in positive direction to break loose and rotate around the axes.
	G6dofJointAngularUpperLimit G6DOFJointAxisParam = 11
	// A factor that gets multiplied onto all rotations across the axes.
	G6dofJointAngularLimitSoftness G6DOFJointAxisParam = 12
	// The amount of rotational damping across the axes. The lower, the more damping occurs.
	G6dofJointAngularDamping G6DOFJointAxisParam = 13
	// The amount of rotational restitution across the axes. The lower, the more restitution occurs.
	G6dofJointAngularRestitution G6DOFJointAxisParam = 14
	// The maximum amount of force that can occur, when rotating around the axes.
	G6dofJointAngularForceLimit G6DOFJointAxisParam = 15
	// When correcting the crossing of limits in rotation across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
	G6dofJointAngularErp G6DOFJointAxisParam = 16
	// Target speed for the motor at the axes.
	G6dofJointAngularMotorTargetVelocity G6DOFJointAxisParam = 17
	// Maximum acceleration for the motor at the axes.
	G6dofJointAngularMotorForceLimit        G6DOFJointAxisParam = 18
	G6dofJointAngularSpringStiffness        G6DOFJointAxisParam = 19
	G6dofJointAngularSpringDamping          G6DOFJointAxisParam = 20
	G6dofJointAngularSpringEquilibriumPoint G6DOFJointAxisParam = 21
	// Represents the size of the [G6DOFJointAxisParam] enum.
	G6dofJointMax G6DOFJointAxisParam = 22
)

type HingeJointFlag

type HingeJointFlag int //gd:PhysicsServer3D.HingeJointFlag
const (
	// If true, the Hinge has a maximum and a minimum rotation.
	HingeJointFlagUseLimit HingeJointFlag = 0
	// If true, a motor turns the Hinge.
	HingeJointFlagEnableMotor HingeJointFlag = 1
)

type HingeJointParam

type HingeJointParam int //gd:PhysicsServer3D.HingeJointParam
const (
	// The speed with which the two bodies get pulled together when they move in different directions.
	HingeJointBias HingeJointParam = 0
	// The maximum rotation across the Hinge.
	HingeJointLimitUpper HingeJointParam = 1
	// The minimum rotation across the Hinge.
	HingeJointLimitLower HingeJointParam = 2
	// The speed with which the rotation across the axis perpendicular to the hinge gets corrected.
	HingeJointLimitBias     HingeJointParam = 3
	HingeJointLimitSoftness HingeJointParam = 4
	// The lower this value, the more the rotation gets slowed down.
	HingeJointLimitRelaxation HingeJointParam = 5
	// Target speed for the motor.
	HingeJointMotorTargetVelocity HingeJointParam = 6
	// Maximum acceleration for the motor.
	HingeJointMotorMaxImpulse HingeJointParam = 7
)

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

Instance of the class with convieniently typed arguments and results.

func (Instance) AsObject

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

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

type JointType

type JointType int //gd:PhysicsServer3D.JointType
const (
	// The [graphics.gd/classdb/Joint3D] is a [graphics.gd/classdb/PinJoint3D].
	JointTypePin JointType = 0
	// The [graphics.gd/classdb/Joint3D] is a [graphics.gd/classdb/HingeJoint3D].
	JointTypeHinge JointType = 1
	// The [graphics.gd/classdb/Joint3D] is a [graphics.gd/classdb/SliderJoint3D].
	JointTypeSlider JointType = 2
	// The [graphics.gd/classdb/Joint3D] is a [graphics.gd/classdb/ConeTwistJoint3D].
	JointTypeConeTwist JointType = 3
	// The [graphics.gd/classdb/Joint3D] is a [graphics.gd/classdb/Generic6DOFJoint3D].
	JointType6dof JointType = 4
	// Represents the size of the [JointType] enum.
	JointTypeMax JointType = 5
)

func JointGetType

func JointGetType(joint RID.Joint3D) JointType

Returns the type of the Joint3D.

type PinJointParam

type PinJointParam int //gd:PhysicsServer3D.PinJointParam
const (
	// The strength with which the pinned objects try to stay in positional relation to each other.
	//
	// The higher, the stronger.
	PinJointBias PinJointParam = 0
	// The strength with which the pinned objects try to stay in velocity relation to each other.
	//
	// The higher, the stronger.
	PinJointDamping PinJointParam = 1
	// If above 0, this value is the maximum value for an impulse that this Joint3D puts on its ends.
	PinJointImpulseClamp PinJointParam = 2
)

type ProcessInfo

type ProcessInfo int //gd:PhysicsServer3D.ProcessInfo
const (
	// Constant to get the number of objects that are not sleeping.
	InfoActiveObjects ProcessInfo = 0
	// Constant to get the number of possible collisions.
	InfoCollisionPairs ProcessInfo = 1
	// Constant to get the number of space regions where a collision could occur.
	InfoIslandCount ProcessInfo = 2
)

type ShapeType

type ShapeType int //gd:PhysicsServer3D.ShapeType
const (
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/WorldBoundaryShape3D].
	ShapeWorldBoundary ShapeType = 0
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/SeparationRayShape3D].
	ShapeSeparationRay ShapeType = 1
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/SphereShape3D].
	ShapeSphere ShapeType = 2
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/BoxShape3D].
	ShapeBox ShapeType = 3
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/CapsuleShape3D].
	ShapeCapsule ShapeType = 4
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/CylinderShape3D].
	ShapeCylinder ShapeType = 5
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/ConvexPolygonShape3D].
	ShapeConvexPolygon ShapeType = 6
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/ConcavePolygonShape3D].
	ShapeConcavePolygon ShapeType = 7
	// The [graphics.gd/classdb/Shape3D] is a [graphics.gd/classdb/HeightMapShape3D].
	ShapeHeightmap ShapeType = 8
	// The [graphics.gd/classdb/Shape3D] is used internally for a soft body. Any attempt to create this kind of shape results in an error.
	ShapeSoftBody ShapeType = 9
	// This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.
	ShapeCustom ShapeType = 10
)

func ShapeGetType

func ShapeGetType(shape RID.Shape3D) ShapeType

Returns the type of shape.

type SliderJointParam

type SliderJointParam int //gd:PhysicsServer3D.SliderJointParam
const (
	// The maximum difference between the pivot points on their X axis before damping happens.
	SliderJointLinearLimitUpper SliderJointParam = 0
	// The minimum difference between the pivot points on their X axis before damping happens.
	SliderJointLinearLimitLower SliderJointParam = 1
	// A factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement.
	SliderJointLinearLimitSoftness SliderJointParam = 2
	// The amount of restitution once the limits are surpassed. The lower, the more velocity-energy gets lost.
	SliderJointLinearLimitRestitution SliderJointParam = 3
	// The amount of damping once the slider limits are surpassed.
	SliderJointLinearLimitDamping SliderJointParam = 4
	// A factor applied to the movement across the slider axis as long as the slider is in the limits. The lower, the slower the movement.
	SliderJointLinearMotionSoftness SliderJointParam = 5
	// The amount of restitution inside the slider limits.
	SliderJointLinearMotionRestitution SliderJointParam = 6
	// The amount of damping inside the slider limits.
	SliderJointLinearMotionDamping SliderJointParam = 7
	// A factor applied to the movement across axes orthogonal to the slider.
	SliderJointLinearOrthogonalSoftness SliderJointParam = 8
	// The amount of restitution when movement is across axes orthogonal to the slider.
	SliderJointLinearOrthogonalRestitution SliderJointParam = 9
	// The amount of damping when movement is across axes orthogonal to the slider.
	SliderJointLinearOrthogonalDamping SliderJointParam = 10
	// The upper limit of rotation in the slider.
	SliderJointAngularLimitUpper SliderJointParam = 11
	// The lower limit of rotation in the slider.
	SliderJointAngularLimitLower SliderJointParam = 12
	// A factor applied to the all rotation once the limit is surpassed.
	SliderJointAngularLimitSoftness SliderJointParam = 13
	// The amount of restitution of the rotation when the limit is surpassed.
	SliderJointAngularLimitRestitution SliderJointParam = 14
	// The amount of damping of the rotation when the limit is surpassed.
	SliderJointAngularLimitDamping SliderJointParam = 15
	// A factor that gets applied to the all rotation in the limits.
	SliderJointAngularMotionSoftness SliderJointParam = 16
	// The amount of restitution of the rotation in the limits.
	SliderJointAngularMotionRestitution SliderJointParam = 17
	// The amount of damping of the rotation in the limits.
	SliderJointAngularMotionDamping SliderJointParam = 18
	// A factor that gets applied to the all rotation across axes orthogonal to the slider.
	SliderJointAngularOrthogonalSoftness SliderJointParam = 19
	// The amount of restitution of the rotation across axes orthogonal to the slider.
	SliderJointAngularOrthogonalRestitution SliderJointParam = 20
	// The amount of damping of the rotation across axes orthogonal to the slider.
	SliderJointAngularOrthogonalDamping SliderJointParam = 21
	// Represents the size of the [SliderJointParam] enum.
	SliderJointMax SliderJointParam = 22
)

type SpaceParameter

type SpaceParameter int //gd:PhysicsServer3D.SpaceParameter
const (
	// Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated.
	SpaceParamContactRecycleRadius SpaceParameter = 0
	// Constant to set/get the maximum distance a shape can be from another before they are considered separated and the contact is discarded.
	SpaceParamContactMaxSeparation SpaceParameter = 1
	// Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision.
	SpaceParamContactMaxAllowedPenetration SpaceParameter = 2
	// Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision.
	SpaceParamContactDefaultBias SpaceParameter = 3
	// Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given.
	SpaceParamBodyLinearVelocitySleepThreshold SpaceParameter = 4
	// Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given.
	SpaceParamBodyAngularVelocitySleepThreshold SpaceParameter = 5
	// Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time.
	SpaceParamBodyTimeToSleep SpaceParameter = 6
	// Constant to set/get the number of solver iterations for contacts and constraints. The greater the number of iterations, the more accurate the collisions and constraints will be. However, a greater number of iterations requires more CPU power, which can decrease performance.
	SpaceParamSolverIterations SpaceParameter = 7
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL