Class PhysicsServer3DInstance
- 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.
[GodotClassName("PhysicsServer3D")]
public class PhysicsServer3DInstance : GodotObject, IDisposable
- Inheritance
-
PhysicsServer3DInstance
- Implements
- Derived
- Inherited Members
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 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 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 void AreaClearShapes(Rid area)
Parameters
area
Rid
AreaCreate()
Creates an Area3D.
public Rid AreaCreate()
Returns
AreaGetCollisionLayer(Rid)
Returns the physics layer or layers an area belongs to.
public uint AreaGetCollisionLayer(Rid area)
Parameters
area
Rid
Returns
AreaGetCollisionMask(Rid)
Returns the physics layer or layers an area can contact with.
public uint AreaGetCollisionMask(Rid area)
Parameters
area
Rid
Returns
AreaGetObjectInstanceId(Rid)
Gets the instance ID of the object the area is assigned to.
public 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 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 Rid AreaGetShape(Rid area, int shapeIdx)
Parameters
Returns
AreaGetShapeCount(Rid)
Returns the number of shapes assigned to an area.
public int AreaGetShapeCount(Rid area)
Parameters
area
Rid
Returns
AreaGetShapeTransform(Rid, int)
Returns the transform matrix of a shape within an area.
public Transform3D AreaGetShapeTransform(Rid area, int shapeIdx)
Parameters
Returns
AreaGetSpace(Rid)
Returns the space assigned to the area.
public Rid AreaGetSpace(Rid area)
Parameters
area
Rid
Returns
AreaGetTransform(Rid)
Returns the transform matrix for an area.
public 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 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 void AreaSetAreaMonitorCallback(Rid area, Callable callback)
Parameters
AreaSetCollisionLayer(Rid, uint)
Assigns the area to one or many physics layers.
public void AreaSetCollisionLayer(Rid area, uint layer)
Parameters
AreaSetCollisionMask(Rid, uint)
Sets which physics layers the area will monitor.
public 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 void AreaSetMonitorCallback(Rid area, Callable callback)
Parameters
AreaSetMonitorable(Rid, bool)
public 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 void AreaSetParam(Rid area, PhysicsServer3D.AreaParameter param, Variant value)
Parameters
area
Ridparam
PhysicsServer3D.AreaParametervalue
Variant
AreaSetRayPickable(Rid, bool)
Sets object pickable with rays.
public 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 void AreaSetShape(Rid area, int shapeIdx, Rid shape)
Parameters
AreaSetShapeDisabled(Rid, int, bool)
public void AreaSetShapeDisabled(Rid area, int shapeIdx, bool disabled)
Parameters
AreaSetShapeTransform(Rid, int, Transform3D)
Sets the transform matrix for an area shape.
public void AreaSetShapeTransform(Rid area, int shapeIdx, Transform3D transform)
Parameters
area
RidshapeIdx
inttransform
Transform3D
AreaSetSpace(Rid, Rid)
Assigns a space to the area.
public void AreaSetSpace(Rid area, Rid space)
Parameters
AreaSetTransform(Rid, Transform3D)
Sets the transform matrix for an area.
public 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 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 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 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 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 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 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 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 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 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 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 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 void BodyAttachObjectInstanceId(Rid body, ulong id)
Parameters
BodyClearShapes(Rid)
Removes all shapes from a body.
public void BodyClearShapes(Rid body)
Parameters
body
Rid
BodyCreate()
public Rid BodyCreate()
Returns
BodyGetCollisionLayer(Rid)
Returns the physics layer or layers a body belongs to.
public uint BodyGetCollisionLayer(Rid body)
Parameters
body
Rid
Returns
BodyGetCollisionMask(Rid)
Returns the physics layer or layers a body can collide with.
public uint BodyGetCollisionMask(Rid body)
Parameters
body
Rid
Returns
BodyGetCollisionPriority(Rid)
Returns the body's collision priority.
public 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 Vector3 BodyGetConstantForce(Rid body)
Parameters
body
Rid
Returns
BodyGetConstantTorque(Rid)
Returns the body's total constant rotational forces applied during each physics update.
public 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 PhysicsDirectBodyState3D BodyGetDirectState(Rid body)
Parameters
body
Rid
Returns
BodyGetMaxContactsReported(Rid)
Returns the maximum contacts that can be reported. See BodySetMaxContactsReported(Rid, int).
public int BodyGetMaxContactsReported(Rid body)
Parameters
body
Rid
Returns
BodyGetMode(Rid)
Returns the body mode.
public PhysicsServer3D.BodyMode BodyGetMode(Rid body)
Parameters
body
Rid
Returns
BodyGetObjectInstanceId(Rid)
Gets the instance ID of the object the area is assigned to.
public 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 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 Rid BodyGetShape(Rid body, int shapeIdx)
Parameters
Returns
BodyGetShapeCount(Rid)
Returns the number of shapes assigned to a body.
public int BodyGetShapeCount(Rid body)
Parameters
body
Rid
Returns
BodyGetShapeTransform(Rid, int)
Returns the transform matrix of a body shape.
public Transform3D BodyGetShapeTransform(Rid body, int shapeIdx)
Parameters
Returns
BodyGetSpace(Rid)
Returns the Rid of the space assigned to a body.
public Rid BodyGetSpace(Rid body)
Parameters
body
Rid
Returns
BodyGetState(Rid, BodyState)
Returns a body state.
public Variant BodyGetState(Rid body, PhysicsServer3D.BodyState state)
Parameters
body
Ridstate
PhysicsServer3D.BodyState
Returns
BodyIsAxisLocked(Rid, BodyAxis)
public 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 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 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 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 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 void BodyResetMassProperties(Rid body)
Parameters
body
Rid
BodySetAxisLock(Rid, BodyAxis, bool)
public 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 void BodySetAxisVelocity(Rid body, Vector3 axisVelocity)
Parameters
BodySetCollisionLayer(Rid, uint)
Sets the physics layer or layers a body belongs to.
public void BodySetCollisionLayer(Rid body, uint layer)
Parameters
BodySetCollisionMask(Rid, uint)
Sets the physics layer or layers a body can collide with.
public void BodySetCollisionMask(Rid body, uint mask)
Parameters
BodySetCollisionPriority(Rid, float)
Sets the body's collision priority.
public 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 void BodySetConstantForce(Rid body, Vector3 force)
Parameters
BodySetConstantTorque(Rid, Vector3)
Sets the body's total constant rotational forces applied during each physics update.
public 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 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 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 void BodySetMaxContactsReported(Rid body, int amount)
Parameters
BodySetMode(Rid, BodyMode)
Sets the body mode, from one of the PhysicsServer3D.BodyMode constants.
public 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 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 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 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 void BodySetShape(Rid body, int shapeIdx, Rid shape)
Parameters
BodySetShapeDisabled(Rid, int, bool)
public void BodySetShapeDisabled(Rid body, int shapeIdx, bool disabled)
Parameters
BodySetShapeTransform(Rid, int, Transform3D)
Sets the transform matrix for a body shape.
public 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 void BodySetSpace(Rid body, Rid space)
Parameters
BodySetState(Rid, BodyState, Variant)
Sets a body state (see PhysicsServer3D.BodyState constants).
public 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 bool BodyTestMotion(Rid body, PhysicsTestMotionParameters3D parameters, PhysicsTestMotionResult3D result = null)
Parameters
body
Ridparameters
PhysicsTestMotionParameters3Dresult
PhysicsTestMotionResult3D
Returns
BoxShapeCreate()
public Rid BoxShapeCreate()
Returns
CapsuleShapeCreate()
public Rid CapsuleShapeCreate()
Returns
ConcavePolygonShapeCreate()
public Rid ConcavePolygonShapeCreate()
Returns
ConeTwistJointGetParam(Rid, ConeTwistJointParam)
Gets a cone_twist_joint parameter (see PhysicsServer3D.ConeTwistJointParam constants).
public 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 void ConeTwistJointSetParam(Rid joint, PhysicsServer3D.ConeTwistJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.ConeTwistJointParamvalue
float
ConvexPolygonShapeCreate()
public Rid ConvexPolygonShapeCreate()
Returns
CustomShapeCreate()
public Rid CustomShapeCreate()
Returns
CylinderShapeCreate()
public 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 void FreeRid(Rid rid)
Parameters
rid
Rid
Generic6DofJointGetFlag(Rid, Axis, G6DofJointAxisFlag)
Gets a generic_6_DOF_joint flag (see PhysicsServer3D.G6DofJointAxisFlag constants).
public 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 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 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 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 int GetProcessInfo(PhysicsServer3D.ProcessInfo processInfo)
Parameters
processInfo
PhysicsServer3D.ProcessInfo
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
HeightmapShapeCreate()
public Rid HeightmapShapeCreate()
Returns
HingeJointGetFlag(Rid, HingeJointFlag)
Gets a hinge_joint flag (see PhysicsServer3D.HingeJointFlag constants).
public 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 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 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 void HingeJointSetParam(Rid joint, PhysicsServer3D.HingeJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.HingeJointParamvalue
float
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
JointClear(Rid)
public void JointClear(Rid joint)
Parameters
joint
Rid
JointCreate()
public Rid JointCreate()
Returns
JointDisableCollisionsBetweenBodies(Rid, bool)
Sets whether the bodies attached to the Joint3D will collide with each other.
public void JointDisableCollisionsBetweenBodies(Rid joint, bool disable)
Parameters
JointGetSolverPriority(Rid)
Gets the priority value of the Joint3D.
public int JointGetSolverPriority(Rid joint)
Parameters
joint
Rid
Returns
JointGetType(Rid)
Returns the type of the Joint3D.
public 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 bool JointIsDisabledCollisionsBetweenBodies(Rid joint)
Parameters
joint
Rid
Returns
JointMakeConeTwist(Rid, Rid, Transform3D, Rid, Transform3D)
public 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 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 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 void JointMakePin(Rid joint, Rid bodyA, Vector3 localA, Rid bodyB, Vector3 localB)
Parameters
JointMakeSlider(Rid, Rid, Transform3D, Rid, Transform3D)
public 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 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 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 Vector3 PinJointGetLocalB(Rid joint)
Parameters
joint
Rid
Returns
PinJointGetParam(Rid, PinJointParam)
Gets a pin_joint parameter (see PhysicsServer3D.PinJointParam constants).
public 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 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 void PinJointSetLocalB(Rid joint, Vector3 localB)
Parameters
PinJointSetParam(Rid, PinJointParam, float)
Sets a pin_joint parameter (see PhysicsServer3D.PinJointParam constants).
public void PinJointSetParam(Rid joint, PhysicsServer3D.PinJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.PinJointParamvalue
float
SeparationRayShapeCreate()
public Rid SeparationRayShapeCreate()
Returns
SetActive(bool)
Activates or deactivates the 3D physics engine.
public void SetActive(bool active)
Parameters
active
bool
ShapeGetData(Rid)
Returns the shape data.
public Variant ShapeGetData(Rid shape)
Parameters
shape
Rid
Returns
ShapeGetType(Rid)
Returns the type of shape (see PhysicsServer3D.ShapeType constants).
public 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 void ShapeSetData(Rid shape, Variant data)
Parameters
SliderJointGetParam(Rid, SliderJointParam)
Gets a slider_joint parameter (see PhysicsServer3D.SliderJointParam constants).
public 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 void SliderJointSetParam(Rid joint, PhysicsServer3D.SliderJointParam param, float value)
Parameters
joint
Ridparam
PhysicsServer3D.SliderJointParamvalue
float
SoftBodyGetBounds(Rid)
public 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 Rid SpaceCreate()
Returns
SpaceGetDirectState(Rid)
Returns the state of a space, a PhysicsDirectSpaceState3D. This object can be used to make collision/intersection queries.
public PhysicsDirectSpaceState3D SpaceGetDirectState(Rid space)
Parameters
space
Rid
Returns
SpaceGetParam(Rid, SpaceParameter)
Returns the value of a space parameter.
public float SpaceGetParam(Rid space, PhysicsServer3D.SpaceParameter param)
Parameters
space
Ridparam
PhysicsServer3D.SpaceParameter
Returns
SpaceIsActive(Rid)
Returns whether the space is active.
public 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 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 void SpaceSetParam(Rid space, PhysicsServer3D.SpaceParameter param, float value)
Parameters
space
Ridparam
PhysicsServer3D.SpaceParametervalue
float
SphereShapeCreate()
public Rid SphereShapeCreate()
Returns
WorldBoundaryShapeCreate()
public Rid WorldBoundaryShapeCreate()