A server interface for low-level 3D physics access. PhysicsServer3D is the server responsible for all 3D physics. It can directly create and manipulate all physics objects: - A [i]space[/i] 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 [i]shape[/i] 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 [i]body[/i] 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 [i]area[/i] 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 [i]joint[/i] 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 [PhysicsServer3D] may be created and manipulated independently; they do not have to be tied to nodes in the scene tree. [b]Note:[/b] 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. 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 [Area3D]. Returns the physics layer or layers an area belongs to. Returns the physics layer or layers an area can contact with. 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 transform matrix for an area. Removes a shape from an area. It does not delete the shape, so it can be reassigned later. 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 [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other area's shape entered or exited the area, 2. an [RID] [code]area_rid[/code]: the [RID] of the other area that entered or exited the area, 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the other area, 4. an integer [code]area_shape_idx[/code]: the index of the shape of the other area that entered or exited the area, 5. an integer [code]self_shape_idx[/code]: 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. Assigns the area to one or many physics layers. Sets which physics layers the area will monitor. 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 [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other body shape entered or exited the area, 2. an [RID] [code]body_rid[/code]: the [RID] of the body that entered or exited the area, 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the body, 4. an integer [code]body_shape_idx[/code]: the index of the shape of the body that entered or exited the area, 5. an integer [code]self_shape_idx[/code]: 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. 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 transform matrix for an area. Adds a body to the list of bodies exempt from collisions. Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector3(0, 0, 0))[/code]. This is equivalent to using [method body_add_constant_force] at the body's center of mass. Adds a constant positioned force to the body that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector3(0, 0, 0))[/code]. [param position] is the offset from the body origin in global coordinates. Adds a constant rotational force without affecting position that keeps being applied over time until cleared with [code]body_set_constant_torque(body, Vector3(0, 0, 0))[/code]. 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. 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 [method body_apply_force] at the body's center of mass. 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 [method body_apply_impulse] at the body's center of mass. Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update. [param position] is the offset from the body origin in global coordinates. 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). [param position] is the offset from the body origin in global coordinates. Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update. 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). Assigns the area to a descendant of [Object], so it can exist in the node tree. Removes all shapes from a body. Returns the physics layer or layers a body belongs to. Returns the physics layer or layers a body can collide with. Returns the body's collision priority. Returns the body's total constant positional forces applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force]. Returns the body's total constant rotational forces applied during each physics update. See [method body_add_constant_torque]. Returns the [PhysicsDirectBodyState3D] 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 [code]true[/code] if the body is omitting the standard force integration. See [method body_set_omit_force_integration]. 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. Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using [method body_set_param]. 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. Sets the body's collision priority. Sets the body's total constant positional forces applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force]. Sets the body's total constant rotational forces applied during each physics update. See [method body_add_constant_torque]. 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 body's custom force integration callback function to [param callable]. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback. The function [param callable] will be called every physics tick, before the standard force integration (see [method body_set_omit_force_integration]). It can be used for example to update the body's linear and angular velocity based on contact with other bodies. If [param userdata] is not [code]null[/code], the function [param callable] must take the following two parameters: 1. [code]state[/code]: a [PhysicsDirectBodyState3D], used to retrieve and modify the body's state, 2. [code skip-lint]userdata[/code]: a [Variant]; its value will be the [param userdata] passed into this method. If [param userdata] is [code]null[/code], then [param callable] must take only the [code]state[/code] parameter. 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. Sets the body mode, from one of the [enum BodyMode] constants. Sets whether the body omits the standard force integration. If [param enable] is [code]true[/code], the body will not automatically use applied forces, torques, and damping to update the body's linear and angular velocity. In this case, [method body_set_force_integration_callback] can be used to manually update the linear and angular velocity instead. This method is called when the property [member RigidBody3D.custom_integrator] is set. Sets a body parameter. A list of available parameters is on the [enum BodyParameter] constants. Sets the body pickable with rays if [param enable] 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 along a motion vector from a given point in space. [PhysicsTestMotionParameters3D] is passed to set motion parameters. [PhysicsTestMotionResult3D] can be passed to return additional information. 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 PhysicsServer3D. If the [RID] passed is not one of the objects that can be created by PhysicsServer3D, an error will be sent to the console. Returns the value of a generic 6DOF joint flag. See [enum G6DOFJointAxisFlag] for the list of available flags. Returns the value of a generic 6DOF joint parameter. See [enum G6DOFJointAxisParam] for the list of available parameters. Sets the value of a given generic 6DOF joint flag. See [enum G6DOFJointAxisFlag] for the list of available flags. Sets the value of a given generic 6DOF joint parameter. See [enum G6DOFJointAxisParam] for the list of available parameters. Returns information about the current state of the 3D physics engine. See [enum ProcessInfo] for a list of available states. 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). Sets whether the bodies attached to the [Joint3D] will collide with each other. Gets the priority value of the Joint3D. Returns the type of the Joint3D. Returns whether the bodies attached to the [Joint3D] will collide with each other. Make the joint a generic six degrees of freedom (6DOF) joint. Use [method generic_6dof_joint_set_flag] and [method generic_6dof_joint_set_param] to set the joint's flags and parameters respectively. Sets the priority value of the Joint3D. 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. 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). Adds the given body to the list of bodies exempt from collisions. Creates a new soft body and returns its internal [RID]. Returns the bounds of the given soft body in global coordinates. Returns the physics layer or layers that the given soft body belongs to. Returns the physics layer or layers that the given soft body can collide with. Returns the damping coefficient of the given soft body. Returns the drag coefficient of the given soft body. Returns the linear stiffness of the given soft body. Returns the current position of the given soft body point in global coordinates. Returns the pressure coefficient of the given soft body. Returns the simulation precision of the given soft body. Returns the [RID] of the space assigned to the given soft body. Returns the given soft body state (see [enum BodyState] constants). [b]Note:[/b] Godot's default physics implementation does not support [constant BODY_STATE_LINEAR_VELOCITY], [constant BODY_STATE_ANGULAR_VELOCITY], [constant BODY_STATE_SLEEPING], or [constant BODY_STATE_CAN_SLEEP]. Returns the total mass assigned to the given soft body. Returns whether the given soft body point is pinned. Moves the given soft body point to a position in global coordinates. Pins or unpins the given soft body point based on the value of [param pin]. [b]Note:[/b] Pinning a point effectively makes it kinematic, preventing it from being affected by forces, but you can still move it using [method soft_body_move_point]. Unpins all points of the given soft body. Removes the given body from the list of bodies exempt from collisions. Sets the physics layer or layers the given soft body belongs to. Sets the physics layer or layers the given soft body can collide with. Sets the damping coefficient of the given soft body. Higher values will slow down the body more noticeably when forces are applied. Sets the drag coefficient of the given soft body. Higher values increase this body's air resistance. [b]Note:[/b] This value is currently unused by Godot's default physics implementation. 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 [code]0.0[/code] and [code]1.0[/code] (inclusive). Sets the mesh of the given soft body. 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. Sets whether the given soft body will be pickable when using object picking. Sets the simulation precision of the given soft body. Increasing this value will improve the resulting simulation, but can affect performance. Use with care. Assigns a space to the given soft body (see [method space_create]). Sets the given body state for the given body (see [enum BodyState] constants). [b]Note:[/b] Godot's default physics implementation does not support [constant BODY_STATE_LINEAR_VELOCITY], [constant BODY_STATE_ANGULAR_VELOCITY], [constant BODY_STATE_SLEEPING], or [constant BODY_STATE_CAN_SLEEP]. Sets the total mass for the given soft body. Sets the global transform of the given soft body. Requests that the physics server updates the rendering server with the latest positions of the given soft body's points through the [param rendering_server_handler] interface. 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 [PhysicsDirectSpaceState3D]. 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 [Joint3D] is a [PinJoint3D]. The [Joint3D] is a [HingeJoint3D]. The [Joint3D] is a [SliderJoint3D]. The [Joint3D] is a [ConeTwistJoint3D]. The [Joint3D] is a [Generic6DOFJoint3D]. Represents the size of the [enum JointType] enum. 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 Joint3D 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 velocity-energy 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 [ConeTwistJoint3D]. 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 Joint3D 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 damping 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. Represents the size of the [enum G6DOFJointAxisParam] enum. 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. Represents the size of the [enum G6DOFJointAxisFlag] enum. The [Shape3D] is a [WorldBoundaryShape3D]. The [Shape3D] is a [SeparationRayShape3D]. The [Shape3D] is a [SphereShape3D]. The [Shape3D] is a [BoxShape3D]. The [Shape3D] is a [CapsuleShape3D]. The [Shape3D] is a [CylinderShape3D]. The [Shape3D] is a [ConvexPolygonShape3D]. The [Shape3D] is a [ConcavePolygonShape3D]. The [Shape3D] is a [HeightMapShape3D]. The [Shape3D] is used internally for a soft body. Any attempt to create this kind of shape results in an error. 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 override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. 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 distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. 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. Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. Constant to set/get the linear damping factor of an area. Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. Constant to set/get the angular damping factor of an area. Constant to set/get the priority (order of processing) of an area. Constant to set/get the magnitude of area-specific wind force. This wind force only applies to [SoftBody3D] nodes. Other physics bodies are currently not affected by wind. Constant to set/get the 3D vector that specifies the origin from which an area-specific wind blows. Constant to set/get the 3D vector that specifies the direction in which an area-specific wind blows. Constant to set/get the exponential rate at which wind force decreases with distance from its origin. 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. In this mode, a body can be only moved by user code and doesn't collide with other bodies along its path when moved. Constant for kinematic bodies. In this mode, a body can be only moved by user code and collides with other bodies along its path. Constant for rigid bodies. In this mode, a body can be pushed by other bodies and has forces applied. Constant for linear rigid bodies. In this mode, a body can not rotate, and only its linear velocity is affected by external forces. 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 inertia. Constant to set/get a body's center of mass position in the body's local coordinate system. Constant to set/get a body's gravity multiplier. Constant to set/get a body's linear damping mode. See [enum BodyDampMode] for possible values. Constant to set/get a body's angular damping mode. See [enum BodyDampMode] for possible values. Constant to set/get a body's linear damping factor. Constant to set/get a body's angular damping factor. Represents the size of the [enum BodyParameter] enum. The body's damping value is added to any value set in areas or the default value. The body's damping value replaces any value set in areas or the default value. 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 and the contact is discarded. Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. 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. 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 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.