Class PhysicsServer3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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 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.
public static class PhysicsServer3D
- Inheritance
-
PhysicsServer3D
- Inherited Members
Properties
Singleton
public static PhysicsServer3DInstance Singleton { get; }
Property Value
Methods
AreaAddShape(Rid, Rid, Transform3D?, 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.
public static void AreaAddShape(Rid area, Rid shape, Transform3D? transform = null, bool disabled = false)
Parameters
area
Ridshape
Ridtransform
Transform3D?If the parameter is null, then the default value is
Transform3D.Identity
.disabled
bool
AreaAttachObjectInstanceId(Rid, ulong)
Assigns the area to a descendant of GodotObject, so it can exist in the node tree.
public static void AreaAttachObjectInstanceId(Rid area, ulong id)
Parameters
AreaClearShapes(Rid)
Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
public static void AreaClearShapes(Rid area)
Parameters
area
Rid
AreaCreate()
Creates an Area3D.
public static Rid AreaCreate()
Returns
AreaGetCollisionLayer(Rid)
Returns the physics layer or layers an area belongs to.
public static uint AreaGetCollisionLayer(Rid area)
Parameters
area
Rid
Returns
AreaGetCollisionMask(Rid)
Returns the physics layer or layers an area can contact with.
public static uint AreaGetCollisionMask(Rid area)
Parameters
area
Rid
Returns
AreaGetObjectInstanceId(Rid)
Gets the instance ID of the object the area is assigned to.
public static ulong AreaGetObjectInstanceId(Rid area)
Parameters
area
Rid
Returns
AreaGetParam(Rid, AreaParameter)
Returns an area parameter value. A list of available parameters is on the PhysicsServer3D.AreaParameter constants.
public static Variant AreaGetParam(Rid area, PhysicsServer3D.AreaParameter param)
Parameters
area
Ridparam
PhysicsServer3D.AreaParameter
Returns
AreaGetShape(Rid, int)
Returns the Rid of the nth shape of an area.
public static Rid AreaGetShape(Rid area, int shapeIdx)
Parameters
Returns
AreaGetShapeCount(Rid)
Returns the number of shapes assigned to an area.
public static int AreaGetShapeCount(Rid area)
Parameters
area
Rid
Returns
AreaGetShapeTransform(Rid, int)
Returns the transform matrix of a shape within an area.
public static Transform3D AreaGetShapeTransform(Rid area, int shapeIdx)
Parameters
Returns
AreaGetSpace(Rid)
Returns the space assigned to the area.
public static Rid AreaGetSpace(Rid area)
Parameters
area
Rid
Returns
AreaGetTransform(Rid)
Returns the transform matrix for an area.
public static Transform3D AreaGetTransform(Rid area)
Parameters
area
Rid
Returns
AreaRemoveShape(Rid, int)
Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
public static void AreaRemoveShape(Rid area, int shapeIdx)
Parameters
AreaSetAreaMonitorCallback(Rid, Callable)
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 Added or Removed depending on whether the other area's shape entered or exited the area,
2. an Ridarea_rid
: the Rid 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.
public static void AreaSetAreaMonitorCallback(Rid area, Callable callback)
Parameters
AreaSetCollisionLayer(Rid, uint)
Assigns the area to one or many physics layers.
public static void AreaSetCollisionLayer(Rid area, uint layer)
Parameters
AreaSetCollisionMask(Rid, uint)
Sets which physics layers the area will monitor.
public static void AreaSetCollisionMask(Rid area, uint mask)
Parameters
AreaSetMonitorCallback(Rid, Callable)
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 Added or Removed depending on whether the other body shape entered or exited the area,
2. an Ridbody_rid
: the Rid 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.
public static void AreaSetMonitorCallback(Rid area, Callable callback)
Parameters
AreaSetMonitorable(Rid, bool)
public static void AreaSetMonitorable(Rid area, bool monitorable)
Parameters
AreaSetParam(Rid, AreaParameter, Variant)
Sets the value for an area parameter. A list of available parameters is on the PhysicsServer3D.AreaParameter constants.
public static void AreaSetParam(Rid area, PhysicsServer3D.AreaParameter param, Variant value)
Parameters
area
Ridparam
PhysicsServer3D.AreaParametervalue
Variant
AreaSetRayPickable(Rid, bool)
Sets object pickable with rays.
public static void AreaSetRayPickable(Rid area, bool enable)
Parameters
AreaSetShape(Rid, int, Rid)
Substitutes a given area shape by another. The old shape is selected by its index, the new one by its Rid.
public static void AreaSetShape(Rid area, int shapeIdx, Rid shape)
Parameters
AreaSetShapeDisabled(Rid, int, bool)
public static void AreaSetShapeDisabled(Rid area, int shapeIdx, bool disabled)
Parameters
AreaSetShapeTransform(Rid, int, Transform3D)
Sets the transform matrix for an area shape.
public static void AreaSetShapeTransform(Rid area, int shapeIdx, Transform3D transform)
Parameters
area
RidshapeIdx
inttransform
Transform3D
AreaSetSpace(Rid, Rid)
Assigns a space to the area.
public static void AreaSetSpace(Rid area, Rid space)
Parameters
AreaSetTransform(Rid, Transform3D)
Sets the transform matrix for an area.
public static void AreaSetTransform(Rid area, Transform3D transform)
Parameters
area
Ridtransform
Transform3D
BodyAddCollisionException(Rid, Rid)
Adds a body to the list of bodies exempt from collisions.
public static void BodyAddCollisionException(Rid body, Rid exceptedBody)
Parameters
BodyAddConstantCentralForce(Rid, Vector3)
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(Rid, Vector3, Vector3?) at the body's center of mass.
public static void BodyAddConstantCentralForce(Rid body, Vector3 force)
Parameters
BodyAddConstantForce(Rid, Vector3, Vector3?)
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.
public static void BodyAddConstantForce(Rid body, Vector3 force, Vector3? position = null)
Parameters
body
Ridforce
Vector3position
Vector3?If the parameter is null, then the default value is
new Vector3(0, 0, 0)
.
BodyAddConstantTorque(Rid, Vector3)
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))
.
public static void BodyAddConstantTorque(Rid body, Vector3 torque)
Parameters
BodyAddShape(Rid, Rid, Transform3D?, 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.
public static void BodyAddShape(Rid body, Rid shape, Transform3D? transform = null, bool disabled = false)
Parameters
body
Ridshape
Ridtransform
Transform3D?If the parameter is null, then the default value is
Transform3D.Identity
.disabled
bool
BodyApplyCentralForce(Rid, Vector3)
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(Rid, Vector3, Vector3?) at the body's center of mass.
public static void BodyApplyCentralForce(Rid body, Vector3 force)
Parameters
BodyApplyCentralImpulse(Rid, Vector3)
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(Rid, Vector3, Vector3?) at the body's center of mass.
public static void BodyApplyCentralImpulse(Rid body, Vector3 impulse)
Parameters
BodyApplyForce(Rid, Vector3, Vector3?)
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.
public static void BodyApplyForce(Rid body, Vector3 force, Vector3? position = null)
Parameters
body
Ridforce
Vector3position
Vector3?If the parameter is null, then the default value is
new Vector3(0, 0, 0)
.
BodyApplyImpulse(Rid, Vector3, Vector3?)
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.
public static void BodyApplyImpulse(Rid body, Vector3 impulse, Vector3? position = null)
Parameters
body
Ridimpulse
Vector3position
Vector3?If the parameter is null, then the default value is
new Vector3(0, 0, 0)
.
BodyApplyTorque(Rid, Vector3)
Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.
public static void BodyApplyTorque(Rid body, Vector3 torque)
Parameters
BodyApplyTorqueImpulse(Rid, Vector3)
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).
public static void BodyApplyTorqueImpulse(Rid body, Vector3 impulse)
Parameters
BodyAttachObjectInstanceId(Rid, ulong)
Assigns the area to a descendant of GodotObject, so it can exist in the node tree.
public static void BodyAttachObjectInstanceId(Rid body, ulong id)
Parameters
BodyClearShapes(Rid)
Removes all shapes from a body.
public static void BodyClearShapes(Rid body)
Parameters
body
Rid
BodyCreate()
public static Rid BodyCreate()
Returns
BodyGetCollisionLayer(Rid)
Returns the physics layer or layers a body belongs to.
public static uint BodyGetCollisionLayer(Rid body)
Parameters
body
Rid
Returns
BodyGetCollisionMask(Rid)
Returns the physics layer or layers a body can collide with.
public static uint BodyGetCollisionMask(Rid body)
Parameters
body
Rid
Returns
BodyGetCollisionPriority(Rid)
Returns the body's collision priority.
public static float BodyGetCollisionPriority(Rid body)
Parameters
body
Rid
Returns
BodyGetConstantForce(Rid)
Returns the body's total constant positional forces applied during each physics update.
See BodyAddConstantForce(Rid, Vector3, Vector3?) and BodyAddConstantCentralForce(Rid, Vector3).
public static Vector3 BodyGetConstantForce(Rid body)
Parameters
body
Rid
Returns
BodyGetConstantTorque(Rid)
Returns the body's total constant rotational forces applied during each physics update.
public static Vector3 BodyGetConstantTorque(Rid body)
Parameters
body
Rid
Returns
BodyGetDirectState(Rid)
Returns the PhysicsDirectBodyState3D of the body. Returns null
if the body is destroyed or removed from the physics space.
public static PhysicsDirectBodyState3D BodyGetDirectState(Rid body)
Parameters
body
Rid
Returns
BodyGetMaxContactsReported(Rid)
Returns the maximum contacts that can be reported. See BodySetMaxContactsReported(Rid, int).
public static int BodyGetMaxContactsReported(Rid body)
Parameters
body
Rid
Returns
BodyGetMode(Rid)
Returns the body mode.
public static PhysicsServer3D.BodyMode BodyGetMode(Rid body)
Parameters
body
Rid
Returns
BodyGetObjectInstanceId(Rid)
Gets the instance ID of the object the area is assigned to.
public static ulong BodyGetObjectInstanceId(Rid body)
Parameters
body
Rid
Returns
BodyGetParam(Rid, BodyParameter)
Returns the value of a body parameter. A list of available parameters is on the PhysicsServer3D.BodyParameter constants.
public static Variant BodyGetParam(Rid body, PhysicsServer3D.BodyParameter param)
Parameters
body
Ridparam
PhysicsServer3D.BodyParameter
Returns
BodyGetShape(Rid, int)
Returns the Rid of the nth shape of a body.
public static Rid BodyGetShape(Rid body, int shapeIdx)
Parameters
Returns
BodyGetShapeCount(Rid)
Returns the number of shapes assigned to a body.
public static int BodyGetShapeCount(Rid body)
Parameters
body
Rid
Returns
BodyGetShapeTransform(Rid, int)
Returns the transform matrix of a body shape.
public static Transform3D BodyGetShapeTransform(Rid body, int shapeIdx)
Parameters
Returns
BodyGetSpace(Rid)
Returns the Rid of the space assigned to a body.
public static Rid BodyGetSpace(Rid body)
Parameters
body
Rid
Returns
BodyGetState(Rid, BodyState)
Returns a body state.
public static Variant BodyGetState(Rid body, PhysicsServer3D.BodyState state)
Parameters
body
Ridstate
PhysicsServer3D.BodyState
Returns
BodyIsAxisLocked(Rid, BodyAxis)
public static bool BodyIsAxisLocked(Rid body, PhysicsServer3D.BodyAxis axis)
Parameters
body
Ridaxis
PhysicsServer3D.BodyAxis
Returns
BodyIsContinuousCollisionDetectionEnabled(Rid)
If true
, the continuous collision detection mode is enabled.
public static bool BodyIsContinuousCollisionDetectionEnabled(Rid body)
Parameters
body
Rid
Returns
BodyIsOmittingForceIntegration(Rid)
Returns whether a body uses a callback function to calculate its own physics (see BodySetForceIntegrationCallback(Rid, Callable, Variant)).
public static bool BodyIsOmittingForceIntegration(Rid body)
Parameters
body
Rid
Returns
BodyRemoveCollisionException(Rid, Rid)
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.
public static void BodyRemoveCollisionException(Rid body, Rid exceptedBody)
Parameters
BodyRemoveShape(Rid, int)
Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
public static void BodyRemoveShape(Rid body, int shapeIdx)
Parameters
BodyResetMassProperties(Rid)
Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using BodySetParam(Rid, BodyParameter, Variant).
public static void BodyResetMassProperties(Rid body)
Parameters
body
Rid
BodySetAxisLock(Rid, BodyAxis, bool)
public static void BodySetAxisLock(Rid body, PhysicsServer3D.BodyAxis axis, bool @lock)
Parameters
body
Ridaxis
PhysicsServer3D.BodyAxislock
bool
BodySetAxisVelocity(Rid, Vector3)
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.
public static void BodySetAxisVelocity(Rid body, Vector3 axisVelocity)
Parameters
BodySetCollisionLayer(Rid, uint)
Sets the physics layer or layers a body belongs to.
public static void BodySetCollisionLayer(Rid body, uint layer)
Parameters
BodySetCollisionMask(Rid, uint)
Sets the physics layer or layers a body can collide with.
public static void BodySetCollisionMask(Rid body, uint mask)
Parameters
BodySetCollisionPriority(Rid, float)
Sets the body's collision priority.
public static void BodySetCollisionPriority(Rid body, float priority)
Parameters
BodySetConstantForce(Rid, Vector3)
Sets the body's total constant positional forces applied during each physics update.
See BodyAddConstantForce(Rid, Vector3, Vector3?) and BodyAddConstantCentralForce(Rid, Vector3).
public static void BodySetConstantForce(Rid body, Vector3 force)
Parameters
BodySetConstantTorque(Rid, Vector3)
Sets the body's total constant rotational forces applied during each physics update.
public static void BodySetConstantTorque(Rid body, Vector3 torque)
Parameters
BodySetEnableContinuousCollisionDetection(Rid, bool)
If true
, the continuous collision detection mode is enabled.
Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.
public static void BodySetEnableContinuousCollisionDetection(Rid body, bool enable)
Parameters
BodySetForceIntegrationCallback(Rid, Callable, Variant)
Sets the function used to calculate physics for an object, if that object allows it (see BodySetOmitForceIntegration(Rid, bool)). The force integration function takes 2 arguments:
- state
— PhysicsDirectBodyState3D used to retrieve and modify the body's state.
- userdata
— optional user data passed to BodySetForceIntegrationCallback(Rid, Callable, Variant).
public static void BodySetForceIntegrationCallback(Rid body, Callable callable, Variant userdata = default)
Parameters
BodySetMaxContactsReported(Rid, int)
Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies. This is enabled by setting the maximum number of contacts reported to a number greater than 0.
public static void BodySetMaxContactsReported(Rid body, int amount)
Parameters
BodySetMode(Rid, BodyMode)
Sets the body mode, from one of the PhysicsServer3D.BodyMode constants.
public static void BodySetMode(Rid body, PhysicsServer3D.BodyMode mode)
Parameters
body
Ridmode
PhysicsServer3D.BodyMode
BodySetOmitForceIntegration(Rid, bool)
Sets whether a body uses a callback function to calculate its own physics (see BodySetForceIntegrationCallback(Rid, Callable, Variant)).
public static void BodySetOmitForceIntegration(Rid body, bool enable)
Parameters
BodySetParam(Rid, BodyParameter, Variant)
Sets a body parameter. A list of available parameters is on the PhysicsServer3D.BodyParameter constants.
public static void BodySetParam(Rid body, PhysicsServer3D.BodyParameter param, Variant value)
Parameters
body
Ridparam
PhysicsServer3D.BodyParametervalue
Variant
BodySetRayPickable(Rid, bool)
Sets the body pickable with rays if enable
is set.
public static void BodySetRayPickable(Rid body, bool enable)
Parameters
BodySetShape(Rid, int, Rid)
Substitutes a given body shape by another. The old shape is selected by its index, the new one by its Rid.
public static void BodySetShape(Rid body, int shapeIdx, Rid shape)
Parameters
BodySetShapeDisabled(Rid, int, bool)
public static void BodySetShapeDisabled(Rid body, int shapeIdx, bool disabled)
Parameters
BodySetShapeTransform(Rid, int, Transform3D)
Sets the transform matrix for a body shape.
public static void BodySetShapeTransform(Rid body, int shapeIdx, Transform3D transform)
Parameters
body
RidshapeIdx
inttransform
Transform3D
BodySetSpace(Rid, Rid)
Assigns a space to the body (see SpaceCreate()).
public static void BodySetSpace(Rid body, Rid space)
Parameters
BodySetState(Rid, BodyState, Variant)
Sets a body state (see PhysicsServer3D.BodyState constants).
public static void BodySetState(Rid body, PhysicsServer3D.BodyState state, Variant value)
Parameters
body
Ridstate
PhysicsServer3D.BodyStatevalue
Variant
BodyTestMotion(Rid, PhysicsTestMotionParameters3D, PhysicsTestMotionResult3D)
Returns true
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.
public static bool BodyTestMotion(Rid body, PhysicsTestMotionParameters3D parameters, PhysicsTestMotionResult3D result = null)
Parameters
body
Ridparameters
PhysicsTestMotionParameters3Dresult
PhysicsTestMotionResult3D
Returns
BoxShapeCreate()
public static Rid BoxShapeCreate()
Returns
CapsuleShapeCreate()
public static Rid CapsuleShapeCreate()
Returns
ConcavePolygonShapeCreate()
public static Rid ConcavePolygonShapeCreate()
Returns
ConeTwistJointGetParam(Rid, ConeTwistJointParam)
Gets a cone_twist_joint parameter (see PhysicsServer3D.ConeTwistJointParam constants).
public static float ConeTwistJointGetParam(Rid joint, PhysicsServer3D.ConeTwistJointParam param)
Parameters
joint
Ridparam
PhysicsServer3D.ConeTwistJointParam
Returns
ConeTwistJointSetParam(Rid, ConeTwistJointParam, float)
Sets a cone_twist_joint parameter (see PhysicsServer3D.ConeTwistJointParam constants).
public static void ConeTwistJointSetParam(Rid joint, PhysicsServer3D.ConeTwistJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.ConeTwistJointParamvalue
float
ConvexPolygonShapeCreate()
public static Rid ConvexPolygonShapeCreate()
Returns
CustomShapeCreate()
public static Rid CustomShapeCreate()
Returns
CylinderShapeCreate()
public static Rid CylinderShapeCreate()
Returns
FreeRid(Rid)
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.
public static void FreeRid(Rid rid)
Parameters
rid
Rid
Generic6DofJointGetFlag(Rid, Axis, G6DofJointAxisFlag)
Gets a generic_6_DOF_joint flag (see PhysicsServer3D.G6DofJointAxisFlag constants).
public static bool Generic6DofJointGetFlag(Rid joint, Vector3.Axis axis, PhysicsServer3D.G6DofJointAxisFlag flag)
Parameters
joint
Ridaxis
Vector3.Axisflag
PhysicsServer3D.G6DofJointAxisFlag
Returns
Generic6DofJointGetParam(Rid, Axis, G6DofJointAxisParam)
Gets a generic_6_DOF_joint parameter (see PhysicsServer3D.G6DofJointAxisParam constants).
public static float Generic6DofJointGetParam(Rid joint, Vector3.Axis axis, PhysicsServer3D.G6DofJointAxisParam param)
Parameters
joint
Ridaxis
Vector3.Axisparam
PhysicsServer3D.G6DofJointAxisParam
Returns
Generic6DofJointSetFlag(Rid, Axis, G6DofJointAxisFlag, bool)
Sets a generic_6_DOF_joint flag (see PhysicsServer3D.G6DofJointAxisFlag constants).
public static void Generic6DofJointSetFlag(Rid joint, Vector3.Axis axis, PhysicsServer3D.G6DofJointAxisFlag flag, bool enable)
Parameters
joint
Ridaxis
Vector3.Axisflag
PhysicsServer3D.G6DofJointAxisFlagenable
bool
Generic6DofJointSetParam(Rid, Axis, G6DofJointAxisParam, float)
Sets a generic_6_DOF_joint parameter (see PhysicsServer3D.G6DofJointAxisParam constants).
public static void Generic6DofJointSetParam(Rid joint, Vector3.Axis axis, PhysicsServer3D.G6DofJointAxisParam param, float value)
Parameters
joint
Ridaxis
Vector3.Axisparam
PhysicsServer3D.G6DofJointAxisParamvalue
float
GetProcessInfo(ProcessInfo)
Returns information about the current state of the 3D physics engine. See PhysicsServer3D.ProcessInfo for a list of available states.
public static int GetProcessInfo(PhysicsServer3D.ProcessInfo processInfo)
Parameters
processInfo
PhysicsServer3D.ProcessInfo
Returns
HeightmapShapeCreate()
public static Rid HeightmapShapeCreate()
Returns
HingeJointGetFlag(Rid, HingeJointFlag)
Gets a hinge_joint flag (see PhysicsServer3D.HingeJointFlag constants).
public static bool HingeJointGetFlag(Rid joint, PhysicsServer3D.HingeJointFlag flag)
Parameters
joint
Ridflag
PhysicsServer3D.HingeJointFlag
Returns
HingeJointGetParam(Rid, HingeJointParam)
Gets a hinge_joint parameter (see PhysicsServer3D.HingeJointParam).
public static float HingeJointGetParam(Rid joint, PhysicsServer3D.HingeJointParam param)
Parameters
joint
Ridparam
PhysicsServer3D.HingeJointParam
Returns
HingeJointSetFlag(Rid, HingeJointFlag, bool)
Sets a hinge_joint flag (see PhysicsServer3D.HingeJointFlag constants).
public static void HingeJointSetFlag(Rid joint, PhysicsServer3D.HingeJointFlag flag, bool enabled)
Parameters
joint
Ridflag
PhysicsServer3D.HingeJointFlagenabled
bool
HingeJointSetParam(Rid, HingeJointParam, float)
Sets a hinge_joint parameter (see PhysicsServer3D.HingeJointParam constants).
public static void HingeJointSetParam(Rid joint, PhysicsServer3D.HingeJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.HingeJointParamvalue
float
JointClear(Rid)
public static void JointClear(Rid joint)
Parameters
joint
Rid
JointCreate()
public static Rid JointCreate()
Returns
JointDisableCollisionsBetweenBodies(Rid, bool)
Sets whether the bodies attached to the Joint3D will collide with each other.
public static void JointDisableCollisionsBetweenBodies(Rid joint, bool disable)
Parameters
JointGetSolverPriority(Rid)
Gets the priority value of the Joint3D.
public static int JointGetSolverPriority(Rid joint)
Parameters
joint
Rid
Returns
JointGetType(Rid)
Returns the type of the Joint3D.
public static PhysicsServer3D.JointType JointGetType(Rid joint)
Parameters
joint
Rid
Returns
JointIsDisabledCollisionsBetweenBodies(Rid)
Returns whether the bodies attached to the Joint3D will collide with each other.
public static bool JointIsDisabledCollisionsBetweenBodies(Rid joint)
Parameters
joint
Rid
Returns
JointMakeConeTwist(Rid, Rid, Transform3D, Rid, Transform3D)
public static void JointMakeConeTwist(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)
Parameters
joint
RidbodyA
RidlocalRefA
Transform3DbodyB
RidlocalRefB
Transform3D
JointMakeGeneric6Dof(Rid, Rid, Transform3D, Rid, Transform3D)
public static void JointMakeGeneric6Dof(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)
Parameters
joint
RidbodyA
RidlocalRefA
Transform3DbodyB
RidlocalRefB
Transform3D
JointMakeHinge(Rid, Rid, Transform3D, Rid, Transform3D)
public static void JointMakeHinge(Rid joint, Rid bodyA, Transform3D hingeA, Rid bodyB, Transform3D hingeB)
Parameters
joint
RidbodyA
RidhingeA
Transform3DbodyB
RidhingeB
Transform3D
JointMakePin(Rid, Rid, Vector3, Rid, Vector3)
public static void JointMakePin(Rid joint, Rid bodyA, Vector3 localA, Rid bodyB, Vector3 localB)
Parameters
JointMakeSlider(Rid, Rid, Transform3D, Rid, Transform3D)
public static void JointMakeSlider(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)
Parameters
joint
RidbodyA
RidlocalRefA
Transform3DbodyB
RidlocalRefB
Transform3D
JointSetSolverPriority(Rid, int)
Sets the priority value of the Joint3D.
public static void JointSetSolverPriority(Rid joint, int priority)
Parameters
PinJointGetLocalA(Rid)
Returns position of the joint in the local space of body a of the joint.
public static Vector3 PinJointGetLocalA(Rid joint)
Parameters
joint
Rid
Returns
PinJointGetLocalB(Rid)
Returns position of the joint in the local space of body b of the joint.
public static Vector3 PinJointGetLocalB(Rid joint)
Parameters
joint
Rid
Returns
PinJointGetParam(Rid, PinJointParam)
Gets a pin_joint parameter (see PhysicsServer3D.PinJointParam constants).
public static float PinJointGetParam(Rid joint, PhysicsServer3D.PinJointParam param)
Parameters
joint
Ridparam
PhysicsServer3D.PinJointParam
Returns
PinJointSetLocalA(Rid, Vector3)
Sets position of the joint in the local space of body a of the joint.
public static void PinJointSetLocalA(Rid joint, Vector3 localA)
Parameters
PinJointSetLocalB(Rid, Vector3)
Sets position of the joint in the local space of body b of the joint.
public static void PinJointSetLocalB(Rid joint, Vector3 localB)
Parameters
PinJointSetParam(Rid, PinJointParam, float)
Sets a pin_joint parameter (see PhysicsServer3D.PinJointParam constants).
public static void PinJointSetParam(Rid joint, PhysicsServer3D.PinJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.PinJointParamvalue
float
SeparationRayShapeCreate()
public static Rid SeparationRayShapeCreate()
Returns
SetActive(bool)
Activates or deactivates the 3D physics engine.
public static void SetActive(bool active)
Parameters
active
bool
ShapeGetData(Rid)
Returns the shape data.
public static Variant ShapeGetData(Rid shape)
Parameters
shape
Rid
Returns
ShapeGetType(Rid)
Returns the type of shape (see PhysicsServer3D.ShapeType constants).
public static PhysicsServer3D.ShapeType ShapeGetType(Rid shape)
Parameters
shape
Rid
Returns
ShapeSetData(Rid, Variant)
Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created ShapeGetType(Rid).
public static void ShapeSetData(Rid shape, Variant data)
Parameters
SliderJointGetParam(Rid, SliderJointParam)
Gets a slider_joint parameter (see PhysicsServer3D.SliderJointParam constants).
public static float SliderJointGetParam(Rid joint, PhysicsServer3D.SliderJointParam param)
Parameters
joint
Ridparam
PhysicsServer3D.SliderJointParam
Returns
SliderJointSetParam(Rid, SliderJointParam, float)
Gets a slider_joint parameter (see PhysicsServer3D.SliderJointParam constants).
public static void SliderJointSetParam(Rid joint, PhysicsServer3D.SliderJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.SliderJointParamvalue
float
SoftBodyGetBounds(Rid)
public static Aabb SoftBodyGetBounds(Rid body)
Parameters
body
Rid
Returns
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(Rid, Rid), or to a body with BodySetSpace(Rid, Rid).
public static Rid SpaceCreate()
Returns
SpaceGetDirectState(Rid)
Returns the state of a space, a PhysicsDirectSpaceState3D. This object can be used to make collision/intersection queries.
public static PhysicsDirectSpaceState3D SpaceGetDirectState(Rid space)
Parameters
space
Rid
Returns
SpaceGetParam(Rid, SpaceParameter)
Returns the value of a space parameter.
public static float SpaceGetParam(Rid space, PhysicsServer3D.SpaceParameter param)
Parameters
space
Ridparam
PhysicsServer3D.SpaceParameter
Returns
SpaceIsActive(Rid)
Returns whether the space is active.
public static bool SpaceIsActive(Rid space)
Parameters
space
Rid
Returns
SpaceSetActive(Rid, bool)
Marks a space as active. It will not have an effect, unless it is assigned to an area or body.
public static void SpaceSetActive(Rid space, bool active)
Parameters
SpaceSetParam(Rid, SpaceParameter, float)
Sets the value for a space parameter. A list of available parameters is on the PhysicsServer3D.SpaceParameter constants.
public static void SpaceSetParam(Rid space, PhysicsServer3D.SpaceParameter param, float value)
Parameters
space
Ridparam
PhysicsServer3D.SpaceParametervalue
float
SphereShapeCreate()
public static Rid SphereShapeCreate()
Returns
WorldBoundaryShapeCreate()
public static Rid WorldBoundaryShapeCreate()