Server interface for low-level physics access.
PhysicsServer is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
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.
Assigns the area to a descendant of [Object], so it can exist in the node tree.
Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
Creates an [Area].
Gets the instance ID of the object the area is assigned to.
Returns an area parameter value. A list of available parameters is on the [enum AreaParameter] constants.
Returns the [RID] of the nth shape of an area.
Returns the number of shapes assigned to an area.
Returns the transform matrix of a shape within an area.
Returns the space assigned to the area.
Returns the space override mode for the area.
Returns the transform matrix for an area.
If [code]true[/code], area collides with rays.
Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
Assigns the area to one or many physics layers.
Sets which physics layers the area will monitor.
Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: 1: [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED], depending on whether the object entered or exited the area. 2: [RID] of the object that entered/exited the area. 3: Instance ID of the object that entered/exited the area. 4: The shape index of the object that entered/exited the area. 5: The shape index of the area where the object entered/exited.
Sets the value for an area parameter. A list of available parameters is on the [enum AreaParameter] constants.
Sets object pickable with rays.
Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [RID].
Sets the transform matrix for an area shape.
Assigns a space to the area.
Sets the space override mode for the area. The modes are described in the [enum AreaSpaceOverrideMode] constants.
Sets the transform matrix for an area.
Adds a body to the list of bodies exempt from collisions.
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.
Gives the body a push at a [code]position[/code] in the direction of the [code]impulse[/code].
Gives the body a push to rotate it.
Assigns the area to a descendant of [Object], so it can exist in the node tree.
Removes all shapes from a body.
Creates a physics body. The first parameter can be any value from [enum BodyMode] constants, for the type of body created. Additionally, the body can be created in sleeping state to save processing time.
Returns the physics layer or layers a body belongs to.
Returns the physics layer or layers a body can collide with.
Returns the [PhysicsDirectBodyState] of the body. Returns [code]null[/code] if the body is destroyed or removed from the physics space.
Returns the maximum contacts that can be reported. See [method body_set_max_contacts_reported].
Returns the body mode.
Gets the instance ID of the object the area is assigned to.
Returns the value of a body parameter. A list of available parameters is on the [enum BodyParameter] constants.
Returns the [RID] of the nth shape of a body.
Returns the number of shapes assigned to a body.
Returns the transform matrix of a body shape.
Returns the [RID] of the space assigned to a body.
Returns a body state.
If [code]true[/code], the continuous collision detection mode is enabled.
Returns whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
If [code]true[/code], the body can be detected by rays.
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.
Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
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.
Sets the physics layer or layers a body belongs to.
Sets the physics layer or layers a body can collide with.
If [code]true[/code], 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.
Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force_integration]).
Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.
Sets the body mode, from one of the [enum BodyMode] constants.
Sets whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
Sets a body parameter. A list of available parameters is on the [enum BodyParameter] constants.
Sets the body pickable with rays if [code]enabled[/code] is set.
Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [RID].
Sets the transform matrix for a body shape.
Assigns a space to the body (see [method space_create]).
Sets a body state (see [enum BodyState] constants).
Returns [code]true[/code] if a collision would result from moving in the given direction from a given point in space. [PhysicsTestMotionResult] can be passed to return additional information in.
Gets a cone_twist_joint parameter (see [enum ConeTwistJointParam] constants).
Sets a cone_twist_joint parameter (see [enum ConeTwistJointParam] constants).
Destroys any of the objects created by PhysicsServer. If the [RID] passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console.
Gets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants).
Gets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants).
Sets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants).
Sets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants).
Returns an Info defined by the [enum ProcessInfo] input given.
Gets a hinge_joint flag (see [enum HingeJointFlag] constants).
Gets a hinge_joint parameter (see [enum HingeJointParam]).
Sets a hinge_joint flag (see [enum HingeJointFlag] constants).
Sets a hinge_joint parameter (see [enum HingeJointParam] constants).
Creates a [ConeTwistJoint].
Creates a [Generic6DOFJoint].
Creates a [HingeJoint].
Creates a [PinJoint].
Creates a [SliderJoint].
Gets the priority value of the Joint.
Returns the type of the Joint.
Sets the priority value of the Joint.
Returns position of the joint in the local space of body a of the joint.
Returns position of the joint in the local space of body b of the joint.
Gets a pin_joint parameter (see [enum PinJointParam] constants).
Sets position of the joint in the local space of body a of the joint.
Sets position of the joint in the local space of body b of the joint.
Sets a pin_joint parameter (see [enum PinJointParam] constants).
Activates or deactivates the 3D physics engine.
Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. The default value is [code]8[/code]. [b]Note:[/b] Only has an effect when using the GodotPhysics engine, not the default Bullet physics engine.
Creates a shape of a type from [enum ShapeType]. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape].
Returns the shape data.
Returns the type of shape (see [enum ShapeType] constants).
Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type].
Gets a slider_joint parameter (see [enum SliderJointParam] constants).
Gets a slider_joint parameter (see [enum SliderJointParam] constants).
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 [method area_set_space], or to a body with [method body_set_space].
Returns the state of a space, a [PhysicsDirectSpaceState]. This object can be used to make collision/intersection queries.
Returns the value of a space parameter.
Returns whether the space is active.
Marks a space as active. It will not have an effect, unless it is assigned to an area or body.
Sets the value for a space parameter. A list of available parameters is on the [enum SpaceParameter] constants.
The [Joint] is a [PinJoint].
The [Joint] is a [HingeJoint].
The [Joint] is a [SliderJoint].
The [Joint] is a [ConeTwistJoint].
The [Joint] is a [Generic6DOFJoint].
The strength with which the pinned objects try to stay in positional relation to each other. The higher, the stronger.
The strength with which the pinned objects try to stay in velocity relation to each other. The higher, the stronger.
If above 0, this value is the maximum value for an impulse that this Joint puts on its ends.
The speed with which the two bodies get pulled together when they move in different directions.
The maximum rotation across the Hinge.
The minimum rotation across the Hinge.
The speed with which the rotation across the axis perpendicular to the hinge gets corrected.
The lower this value, the more the rotation gets slowed down.
Target speed for the motor.
Maximum acceleration for the motor.
If [code]true[/code], the Hinge has a maximum and a minimum rotation.
If [code]true[/code], a motor turns the Hinge.
The maximum difference between the pivot points on their X axis before damping happens.
The minimum difference between the pivot points on their X axis before damping happens.
A factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement.
The amount of restitution once the limits are surpassed. The lower, the more velocityenergy gets lost.
The amount of damping once the slider limits are surpassed.
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.
The amount of restitution inside the slider limits.
The amount of damping inside the slider limits.
A factor applied to the movement across axes orthogonal to the slider.
The amount of restitution when movement is across axes orthogonal to the slider.
The amount of damping when movement is across axes orthogonal to the slider.
The upper limit of rotation in the slider.
The lower limit of rotation in the slider.
A factor applied to the all rotation once the limit is surpassed.
The amount of restitution of the rotation when the limit is surpassed.
The amount of damping of the rotation when the limit is surpassed.
A factor that gets applied to the all rotation in the limits.
The amount of restitution of the rotation in the limits.
The amount of damping of the rotation in the limits.
A factor that gets applied to the all rotation across axes orthogonal to the slider.
The amount of restitution of the rotation across axes orthogonal to the slider.
The amount of damping of the rotation across axes orthogonal to the slider.
Represents the size of the [enum SliderJointParam] enum.
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 [ConeTwistJoint]. If below 0.05, this behavior is locked.
Twist is the rotation around the twist axis, this value defined how far the joint can twist. Twist is locked if below 0.05.
The speed with which the swing or twist will take place. The higher, the faster.
The ease with which the Joint twists, if it's too low, it takes more force to twist the joint.
Defines, how fast the swing- and twist-speed-difference on both sides gets synced.
The minimum difference between the pivot points' axes.
The maximum difference between the pivot points' axes.
A factor that gets applied to the movement across the axes. The lower, the slower the movement.
The amount of restitution on the axes movement. The lower, the more velocity-energy gets lost.
The amount of damping that happens at the linear motion across the axes.
The velocity that the joint's linear motor will attempt to reach.
The maximum force that the linear motor can apply while trying to reach the target velocity.
The minimum rotation in negative direction to break loose and rotate around the axes.
The minimum rotation in positive direction to break loose and rotate around the axes.
A factor that gets multiplied onto all rotations across the axes.
The amount of rotational damping across the axes. The lower, the more dampening occurs.
The amount of rotational restitution across the axes. The lower, the more restitution occurs.
The maximum amount of force that can occur, when rotating around the axes.
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.
Target speed for the motor at the axes.
Maximum acceleration for the motor at the axes.
If set, linear motion is possible within the given limits.
If set, rotational motion is possible.
If set, there is a rotational motor across these axes.
If set, there is a linear motor on this axis that targets a specific velocity.
The [Shape] is a [PlaneShape].
The [Shape] is a [RayShape].
The [Shape] is a [SphereShape].
The [Shape] is a [BoxShape].
The [Shape] is a [CapsuleShape].
The [Shape] is a [CylinderShape].
The [Shape] is a [ConvexPolygonShape].
The [Shape] is a [ConcavePolygonShape].
The [Shape] is a [HeightMapShape].
This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.
Constant to set/get gravity strength in an area.
Constant to set/get gravity vector/center in an area.
Constant to set/get whether the gravity vector of an area is a direction, or a center point.
Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance.
This constant was used to set/get the falloff factor for point gravity. It has been superseded by [constant AREA_PARAM_GRAVITY_DISTANCE_SCALE].
Constant to set/get the linear dampening factor of an area.
Constant to set/get the angular dampening factor of an area.
Constant to set/get the priority (order of processing) of an area.
This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them.
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.
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.
This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
Constant for static bodies.
Constant for kinematic bodies.
Constant for rigid bodies.
Constant for rigid bodies in character mode. In this mode, a body can not rotate, and only its linear velocity is affected by physics.
Constant to set/get a body's bounce factor.
Constant to set/get a body's friction.
Constant to set/get a body's mass.
Constant to set/get a body's gravity multiplier.
Constant to set/get a body's linear dampening factor.
Constant to set/get a body's angular dampening factor.
Represents the size of the [enum BodyParameter] enum.
Constant to set/get the current transform matrix of the body.
Constant to set/get the current linear velocity of the body.
Constant to set/get the current angular velocity of the body.
Constant to sleep/wake up a body, or to get whether it is sleeping.
Constant to set/get whether the body can sleep.
The value of the first parameter and area callback function receives, when an object enters one of its shapes.
The value of the first parameter and area callback function receives, when an object exits one of its shapes.
Constant to get the number of objects that are not sleeping.
Constant to get the number of possible collisions.
Constant to get the number of space regions where a collision could occur.
Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated.
Constant to set/get the maximum distance a shape can be from another before they are considered separated.
Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision.
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.
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.
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.
Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision.