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 ¶
- func Advanced() class
- func AreaAddShape(area RID.Area3D, shape RID.Shape3D, disabled bool)
- func AreaAddShapeOptions(area RID.Area3D, shape RID.Shape3D, transform Transform3D.BasisOrigin, ...)
- func AreaAttachObjectInstanceId(area RID.Area3D, id int)
- func AreaClearShapes(area RID.Area3D)
- func AreaCreate() RID.Area3D
- func AreaGetCollisionLayer(area RID.Area3D) int
- func AreaGetCollisionMask(area RID.Area3D) int
- func AreaGetObjectInstanceId(area RID.Area3D) int
- func AreaGetParam(area RID.Area3D, param AreaParameter) any
- func AreaGetShape(area RID.Area3D, shape_idx int) RID.Shape3D
- func AreaGetShapeCount(area RID.Area3D) int
- func AreaGetShapeTransform(area RID.Area3D, shape_idx int) Transform3D.BasisOrigin
- func AreaGetSpace(area RID.Area3D) RID.Space3D
- func AreaGetTransform(area RID.Area3D) Transform3D.BasisOrigin
- func AreaRemoveShape(area RID.Area3D, shape_idx int)
- func AreaSetAreaMonitorCallback(area RID.Area3D, ...)
- func AreaSetCollisionLayer(area RID.Area3D, layer int)
- func AreaSetCollisionMask(area RID.Area3D, mask int)
- func AreaSetMonitorCallback(area RID.Area3D, ...)
- func AreaSetMonitorable(area RID.Area3D, monitorable bool)
- func AreaSetParam(area RID.Area3D, param AreaParameter, value any)
- func AreaSetRayPickable(area RID.Area3D, enable bool)
- func AreaSetShape(area RID.Area3D, shape_idx int, shape RID.Shape3D)
- func AreaSetShapeDisabled(area RID.Area3D, shape_idx int, disabled bool)
- func AreaSetShapeTransform(area RID.Area3D, shape_idx int, transform Transform3D.BasisOrigin)
- func AreaSetSpace(area RID.Area3D, space RID.Space3D)
- func AreaSetTransform(area RID.Area3D, transform Transform3D.BasisOrigin)
- func BodyAddCollisionException(body RID.Body3D, excepted_body RID.Body3D)
- func BodyAddConstantCentralForce(body RID.Body3D, force Vector3.XYZ)
- func BodyAddConstantForce(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)
- func BodyAddConstantForceOptions(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)
- func BodyAddConstantTorque(body RID.Body3D, torque Vector3.XYZ)
- func BodyAddShape(body RID.Body3D, shape RID.Shape3D, disabled bool)
- func BodyAddShapeOptions(body RID.Body3D, shape RID.Shape3D, transform Transform3D.BasisOrigin, ...)
- func BodyApplyCentralForce(body RID.Body3D, force Vector3.XYZ)
- func BodyApplyCentralImpulse(body RID.Body3D, impulse Vector3.XYZ)
- func BodyApplyForce(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)
- func BodyApplyForceOptions(body RID.Body3D, force Vector3.XYZ, position Vector3.XYZ)
- func BodyApplyImpulse(body RID.Body3D, impulse Vector3.XYZ, position Vector3.XYZ)
- func BodyApplyImpulseOptions(body RID.Body3D, impulse Vector3.XYZ, position Vector3.XYZ)
- func BodyApplyTorque(body RID.Body3D, torque Vector3.XYZ)
- func BodyApplyTorqueImpulse(body RID.Body3D, impulse Vector3.XYZ)
- func BodyAttachObjectInstanceId(body RID.Body3D, id int)
- func BodyClearShapes(body RID.Body3D)
- func BodyCreate() RID.Body3D
- func BodyGetCollisionLayer(body RID.Body3D) int
- func BodyGetCollisionMask(body RID.Body3D) int
- func BodyGetCollisionPriority(body RID.Body3D) Float.X
- func BodyGetConstantForce(body RID.Body3D) Vector3.XYZ
- func BodyGetConstantTorque(body RID.Body3D) Vector3.XYZ
- func BodyGetDirectState(body RID.Body3D) PhysicsDirectBodyState3D.Instance
- func BodyGetMaxContactsReported(body RID.Body3D) int
- func BodyGetObjectInstanceId(body RID.Body3D) int
- func BodyGetParam(body RID.Body3D, param BodyParameter) any
- func BodyGetShape(body RID.Body3D, shape_idx int) RID.Shape3D
- func BodyGetShapeCount(body RID.Body3D) int
- func BodyGetShapeTransform(body RID.Body3D, shape_idx int) Transform3D.BasisOrigin
- func BodyGetSpace(body RID.Body3D) RID.Space3D
- func BodyGetState(body RID.Body3D, state BodyState) any
- func BodyIsAxisLocked(body RID.Body3D, axis BodyAxis) bool
- func BodyIsContinuousCollisionDetectionEnabled(body RID.Body3D) bool
- func BodyIsOmittingForceIntegration(body RID.Body3D) bool
- func BodyRemoveCollisionException(body RID.Body3D, excepted_body RID.Body3D)
- func BodyRemoveShape(body RID.Body3D, shape_idx int)
- func BodyResetMassProperties(body RID.Body3D)
- func BodySetAxisLock(body RID.Body3D, axis BodyAxis, lock bool)
- func BodySetAxisVelocity(body RID.Body3D, axis_velocity Vector3.XYZ)
- func BodySetCollisionLayer(body RID.Body3D, layer int)
- func BodySetCollisionMask(body RID.Body3D, mask int)
- func BodySetCollisionPriority(body RID.Body3D, priority Float.X)
- func BodySetConstantForce(body RID.Body3D, force Vector3.XYZ)
- func BodySetConstantTorque(body RID.Body3D, torque Vector3.XYZ)
- func BodySetEnableContinuousCollisionDetection(body RID.Body3D, enable bool)
- func BodySetForceIntegrationCallback(body RID.Body3D, ...)
- func BodySetForceIntegrationCallbackOptions(body RID.Body3D, ...)
- func BodySetMaxContactsReported(body RID.Body3D, amount int)
- func BodySetMode(body RID.Body3D, mode BodyMode)
- func BodySetOmitForceIntegration(body RID.Body3D, enable bool)
- func BodySetParam(body RID.Body3D, param BodyParameter, value any)
- func BodySetRayPickable(body RID.Body3D, enable bool)
- func BodySetShape(body RID.Body3D, shape_idx int, shape RID.Shape3D)
- func BodySetShapeDisabled(body RID.Body3D, shape_idx int, disabled bool)
- func BodySetShapeTransform(body RID.Body3D, shape_idx int, transform Transform3D.BasisOrigin)
- func BodySetSpace(body RID.Body3D, space RID.Space3D)
- func BodySetState(body RID.Body3D, state BodyState, value any)
- func BodySetStateSyncCallback(body RID.Body3D, callable func(state PhysicsDirectBodyState3D.Instance))
- func BodyTestMotion(body RID.Body3D, parameters PhysicsTestMotionParameters3D.Instance, ...) bool
- func BodyTestMotionOptions(body RID.Body3D, parameters PhysicsTestMotionParameters3D.Instance, ...) bool
- func BoxShapeCreate() RID.Shape3D
- func CapsuleShapeCreate() RID.Shape3D
- func ConcavePolygonShapeCreate() RID.Shape3D
- func ConeTwistJointGetParam(joint RID.Joint3D, param ConeTwistJointParam) Float.X
- func ConeTwistJointSetParam(joint RID.Joint3D, param ConeTwistJointParam, value Float.X)
- func ConvexPolygonShapeCreate() RID.Shape3D
- func CustomShapeCreate() RID.Shape3D
- func CylinderShapeCreate() RID.Shape3D
- func FreeRid(rid RID.Any)
- func Generic6dofJointGetFlag(joint RID.Joint3D, axis Vector3.Axis, flag G6DOFJointAxisFlag) bool
- func Generic6dofJointGetParam(joint RID.Joint3D, axis Vector3.Axis, param G6DOFJointAxisParam) Float.X
- func Generic6dofJointSetFlag(joint RID.Joint3D, axis Vector3.Axis, flag G6DOFJointAxisFlag, enable bool)
- func Generic6dofJointSetParam(joint RID.Joint3D, axis Vector3.Axis, param G6DOFJointAxisParam, value Float.X)
- func GetProcessInfo(process_info ProcessInfo) int
- func HeightmapShapeCreate() RID.Shape3D
- func HingeJointGetFlag(joint RID.Joint3D, flag HingeJointFlag) bool
- func HingeJointGetParam(joint RID.Joint3D, param HingeJointParam) Float.X
- func HingeJointSetFlag(joint RID.Joint3D, flag HingeJointFlag, enabled bool)
- func HingeJointSetParam(joint RID.Joint3D, param HingeJointParam, value Float.X)
- func JointClear(joint RID.Joint3D)
- func JointCreate() RID.Joint3D
- func JointDisableCollisionsBetweenBodies(joint RID.Joint3D, disable bool)
- func JointGetSolverPriority(joint RID.Joint3D) int
- func JointIsDisabledCollisionsBetweenBodies(joint RID.Joint3D) bool
- func JointMakeConeTwist(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, ...)
- func JointMakeGeneric6dof(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, ...)
- func JointMakeHinge(joint RID.Joint3D, body_A RID.Body3D, hinge_A Transform3D.BasisOrigin, ...)
- func JointMakePin(joint RID.Joint3D, body_A RID.Body3D, local_A Vector3.XYZ, body_B RID.Body3D, ...)
- func JointMakeSlider(joint RID.Joint3D, body_A RID.Body3D, local_ref_A Transform3D.BasisOrigin, ...)
- func JointSetSolverPriority(joint RID.Joint3D, priority int)
- func PinJointGetLocalA(joint RID.Joint3D) Vector3.XYZ
- func PinJointGetLocalB(joint RID.Joint3D) Vector3.XYZ
- func PinJointGetParam(joint RID.Joint3D, param PinJointParam) Float.X
- func PinJointSetLocalA(joint RID.Joint3D, local_A Vector3.XYZ)
- func PinJointSetLocalB(joint RID.Joint3D, local_B Vector3.XYZ)
- func PinJointSetParam(joint RID.Joint3D, param PinJointParam, value Float.X)
- func SeparationRayShapeCreate() RID.Shape3D
- func SetActive(active bool)
- func ShapeGetData(shape RID.Shape3D) any
- func ShapeGetMargin(shape RID.Shape3D) Float.X
- func ShapeSetData(shape RID.Shape3D, data any)
- func ShapeSetMargin(shape RID.Shape3D, margin Float.X)
- func SliderJointGetParam(joint RID.Joint3D, param SliderJointParam) Float.X
- func SliderJointSetParam(joint RID.Joint3D, param SliderJointParam, value Float.X)
- func SoftBodyAddCollisionException(body RID.SoftBody3D, body_b RID.Body3D)
- func SoftBodyApplyCentralForce(body RID.Body2D, force Vector3.XYZ)
- func SoftBodyApplyCentralImpulse(body RID.Body2D, impulse Vector3.XYZ)
- func SoftBodyApplyPointForce(body RID.Body2D, point_index int, force Vector3.XYZ)
- func SoftBodyApplyPointImpulse(body RID.Body2D, point_index int, impulse Vector3.XYZ)
- func SoftBodyCreate() RID.SoftBody3D
- func SoftBodyGetBounds(body RID.SoftBody3D) AABB.PositionSize
- func SoftBodyGetCollisionLayer(body RID.SoftBody3D) int
- func SoftBodyGetCollisionMask(body RID.SoftBody3D) int
- func SoftBodyGetDampingCoefficient(body RID.SoftBody3D) Float.X
- func SoftBodyGetDragCoefficient(body RID.SoftBody3D) Float.X
- func SoftBodyGetLinearStiffness(body RID.SoftBody3D) Float.X
- func SoftBodyGetPointGlobalPosition(body RID.SoftBody3D, point_index int) Vector3.XYZ
- func SoftBodyGetPressureCoefficient(body RID.SoftBody3D) Float.X
- func SoftBodyGetShrinkingFactor(body RID.Body2D) Float.X
- func SoftBodyGetSimulationPrecision(body RID.SoftBody3D) int
- func SoftBodyGetSpace(body RID.SoftBody3D) RID.Space3D
- func SoftBodyGetState(body RID.SoftBody3D, state BodyState) any
- func SoftBodyGetTotalMass(body RID.SoftBody3D) Float.X
- func SoftBodyIsPointPinned(body RID.SoftBody3D, point_index int) bool
- func SoftBodyMovePoint(body RID.SoftBody3D, point_index int, global_position Vector3.XYZ)
- func SoftBodyPinPoint(body RID.SoftBody3D, point_index int, pin bool)
- func SoftBodyRemoveAllPinnedPoints(body RID.SoftBody3D)
- func SoftBodyRemoveCollisionException(body RID.SoftBody3D, body_b RID.Body3D)
- func SoftBodySetCollisionLayer(body RID.SoftBody3D, layer int)
- func SoftBodySetCollisionMask(body RID.SoftBody3D, mask int)
- func SoftBodySetDampingCoefficient(body RID.SoftBody3D, damping_coefficient Float.X)
- func SoftBodySetDragCoefficient(body RID.SoftBody3D, drag_coefficient Float.X)
- func SoftBodySetLinearStiffness(body RID.SoftBody3D, stiffness Float.X)
- func SoftBodySetMesh(body RID.SoftBody3D, mesh RID.Mesh)
- func SoftBodySetPressureCoefficient(body RID.SoftBody3D, pressure_coefficient Float.X)
- func SoftBodySetRayPickable(body RID.SoftBody3D, enable bool)
- func SoftBodySetShrinkingFactor(body RID.Body2D, shrinking_factor Float.X)
- func SoftBodySetSimulationPrecision(body RID.SoftBody3D, simulation_precision int)
- func SoftBodySetSpace(body RID.SoftBody3D, space RID.Space3D)
- func SoftBodySetState(body RID.SoftBody3D, state BodyState, v any)
- func SoftBodySetTotalMass(body RID.SoftBody3D, total_mass Float.X)
- func SoftBodySetTransform(body RID.SoftBody3D, transform Transform3D.BasisOrigin)
- func SoftBodyUpdateRenderingServer(body RID.SoftBody3D, ...)
- func SpaceCreate() RID.Space3D
- func SpaceGetDirectState(space RID.Space3D) PhysicsDirectSpaceState3D.Instance
- func SpaceGetParam(space RID.Space3D, param SpaceParameter) Float.X
- func SpaceIsActive(space RID.Space3D) bool
- func SpaceSetActive(space RID.Space3D, active bool)
- func SpaceSetParam(space RID.Space3D, param SpaceParameter, value Float.X)
- func SphereShapeCreate() RID.Shape3D
- func WorldBoundaryShapeCreate() RID.Shape3D
- type AreaBodyStatus
- type AreaParameter
- type AreaSpaceOverrideMode
- type BodyAxis
- type BodyDampMode
- type BodyMode
- type BodyParameter
- type BodyState
- type ConeTwistJointParam
- type Extension
- type G6DOFJointAxisFlag
- type G6DOFJointAxisParam
- type HingeJointFlag
- type HingeJointParam
- type ID
- type Instance
- type JointType
- type PinJointParam
- type ProcessInfo
- type ShapeType
- type SliderJointParam
- type SpaceParameter
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 ¶
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 ¶
Assigns the area to a descendant of graphics.gd/classdb/Object, so it can exist in the node tree.
func AreaClearShapes ¶
Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
func AreaCreate ¶
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 ¶
Returns the physics layer or layers an area belongs to.
func AreaGetCollisionMask ¶
Returns the physics layer or layers an area can contact with.
func AreaGetObjectInstanceId ¶
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 ¶
Returns the [Resource.ID] of the nth shape of an area.
func AreaGetShapeCount ¶
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 ¶
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 ¶
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 ¶
Assigns the area to one or many physics layers.
func AreaSetCollisionMask ¶
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 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 ¶
Sets object pickable with rays.
func AreaSetShape ¶
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 AreaSetShapeTransform ¶
func AreaSetShapeTransform(area RID.Area3D, shape_idx int, transform Transform3D.BasisOrigin)
Sets the transform matrix for an area shape.
func AreaSetSpace ¶
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 ¶
Adds a body to the list of bodies exempt from collisions.
func BodyAddConstantCentralForce ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.
func BodyApplyTorqueImpulse ¶
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 ¶
Assigns the area to a descendant of graphics.gd/classdb/Object, so it can exist in the node tree.
func BodyCreate ¶
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 ¶
Returns the physics layer or layers a body belongs to.
func BodyGetCollisionMask ¶
Returns the physics layer or layers a body can collide with.
func BodyGetCollisionPriority ¶
Returns the body's collision priority.
func BodyGetConstantForce ¶
Returns the body's total constant positional forces applied during each physics update.
func BodyGetConstantTorque ¶
Returns the body's total constant rotational forces applied during each physics update.
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 ¶
Returns the maximum contacts that can be reported. See BodySetMaxContactsReported.
func BodyGetObjectInstanceId ¶
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 ¶
Returns the [Resource.ID] of the nth shape of a body.
func BodyGetShapeCount ¶
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 ¶
Returns the [Resource.ID] of the space assigned to a body.
func BodyIsContinuousCollisionDetectionEnabled ¶
If true, the continuous collision detection mode is enabled.
func BodyIsOmittingForceIntegration ¶
Returns true if the body is omitting the standard force integration. See BodySetOmitForceIntegration.
func BodyRemoveCollisionException ¶
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 ¶
Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
func BodyResetMassProperties ¶
Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using BodySetParam.
func BodySetAxisVelocity ¶
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 ¶
Sets the physics layer or layers a body belongs to.
func BodySetCollisionMask ¶
Sets the physics layer or layers a body can collide with.
func BodySetCollisionPriority ¶
Sets the body's collision priority.
func BodySetConstantForce ¶
Sets the body's total constant positional forces applied during each physics update.
func BodySetConstantTorque ¶
Sets the body's total constant rotational forces applied during each physics update.
func BodySetEnableContinuousCollisionDetection ¶
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 ¶
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 BodySetOmitForceIntegration ¶
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 ¶
Sets the body pickable with rays if 'enable' is set.
func BodySetShape ¶
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 BodySetShapeTransform ¶
func BodySetShapeTransform(body RID.Body3D, shape_idx int, transform Transform3D.BasisOrigin)
Sets the transform matrix for a body shape.
func BodySetSpace ¶
Assigns a space to the body (see SpaceCreate).
func BodySetState ¶
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 ¶
func BodyTestMotion(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 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 CapsuleShapeCreate ¶
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 CustomShapeCreate ¶
func CylinderShapeCreate ¶
func FreeRid ¶
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 ¶
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 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 JointCreate ¶
func JointDisableCollisionsBetweenBodies ¶
Sets whether the bodies attached to the graphics.gd/classdb/Joint3D will collide with each other.
func JointGetSolverPriority ¶
Gets the priority value of the Joint3D.
func JointIsDisabledCollisionsBetweenBodies ¶
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 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 ¶
Sets the priority value of the Joint3D.
func PinJointGetLocalA ¶
Returns position of the joint in the local space of body a of the joint.
func PinJointGetLocalB ¶
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 ¶
Sets position of the joint in the local space of body a of the joint.
func PinJointSetLocalB ¶
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 ShapeGetMargin ¶
Returns the collision margin for the shape.
Note: This is not used in Godot Physics, so will always return 0.
func ShapeSetData ¶
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 ¶
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 ¶
Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.
func SoftBodyApplyCentralImpulse ¶
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 ¶
Applies a force to a point. A force is time dependent and meant to be applied every physics update.
func SoftBodyApplyPointImpulse ¶
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 ¶
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 ¶
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 ¶
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 ¶
Returns whether the space is active.
func SpaceSetActive ¶
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 ¶
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 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 )
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 ¶
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
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 ¶
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.PhysicsServer3D
Instance of the class with convieniently typed arguments and results.
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 )
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 )
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 )