Table of Contents

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

PhysicsServer3DInstance

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 Rid
shape Rid
transform 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

area Rid
id ulong

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

Rid

AreaGetCollisionLayer(Rid)

Returns the physics layer or layers an area belongs to.

public static uint AreaGetCollisionLayer(Rid area)

Parameters

area Rid

Returns

uint

AreaGetCollisionMask(Rid)

Returns the physics layer or layers an area can contact with.

public static uint AreaGetCollisionMask(Rid area)

Parameters

area Rid

Returns

uint

AreaGetObjectInstanceId(Rid)

Gets the instance ID of the object the area is assigned to.

public static ulong AreaGetObjectInstanceId(Rid area)

Parameters

area Rid

Returns

ulong

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 Rid
param PhysicsServer3D.AreaParameter

Returns

Variant

AreaGetShape(Rid, int)

Returns the Rid of the nth shape of an area.

public static Rid AreaGetShape(Rid area, int shapeIdx)

Parameters

area Rid
shapeIdx int

Returns

Rid

AreaGetShapeCount(Rid)

Returns the number of shapes assigned to an area.

public static int AreaGetShapeCount(Rid area)

Parameters

area Rid

Returns

int

AreaGetShapeTransform(Rid, int)

Returns the transform matrix of a shape within an area.

public static Transform3D AreaGetShapeTransform(Rid area, int shapeIdx)

Parameters

area Rid
shapeIdx int

Returns

Transform3D

AreaGetSpace(Rid)

Returns the space assigned to the area.

public static Rid AreaGetSpace(Rid area)

Parameters

area Rid

Returns

Rid

AreaGetTransform(Rid)

Returns the transform matrix for an area.

public static Transform3D AreaGetTransform(Rid area)

Parameters

area Rid

Returns

Transform3D

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

area Rid
shapeIdx int

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

area Rid
callback Callable

AreaSetCollisionLayer(Rid, uint)

Assigns the area to one or many physics layers.

public static void AreaSetCollisionLayer(Rid area, uint layer)

Parameters

area Rid
layer uint

AreaSetCollisionMask(Rid, uint)

Sets which physics layers the area will monitor.

public static void AreaSetCollisionMask(Rid area, uint mask)

Parameters

area Rid
mask uint

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

area Rid
callback Callable

AreaSetMonitorable(Rid, bool)

public static void AreaSetMonitorable(Rid area, bool monitorable)

Parameters

area Rid
monitorable bool

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 Rid
param PhysicsServer3D.AreaParameter
value Variant

AreaSetRayPickable(Rid, bool)

Sets object pickable with rays.

public static void AreaSetRayPickable(Rid area, bool enable)

Parameters

area Rid
enable bool

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

area Rid
shapeIdx int
shape Rid

AreaSetShapeDisabled(Rid, int, bool)

public static void AreaSetShapeDisabled(Rid area, int shapeIdx, bool disabled)

Parameters

area Rid
shapeIdx int
disabled bool

AreaSetShapeTransform(Rid, int, Transform3D)

Sets the transform matrix for an area shape.

public static void AreaSetShapeTransform(Rid area, int shapeIdx, Transform3D transform)

Parameters

area Rid
shapeIdx int
transform Transform3D

AreaSetSpace(Rid, Rid)

Assigns a space to the area.

public static void AreaSetSpace(Rid area, Rid space)

Parameters

area Rid
space Rid

AreaSetTransform(Rid, Transform3D)

Sets the transform matrix for an area.

public static void AreaSetTransform(Rid area, Transform3D transform)

Parameters

area Rid
transform Transform3D

BodyAddCollisionException(Rid, Rid)

Adds a body to the list of bodies exempt from collisions.

public static void BodyAddCollisionException(Rid body, Rid exceptedBody)

Parameters

body Rid
exceptedBody Rid

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

body Rid
force Vector3

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 Rid
force Vector3
position 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

body Rid
torque Vector3

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 Rid
shape Rid
transform 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

body Rid
force Vector3

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

body Rid
impulse Vector3

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 Rid
force Vector3
position 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 Rid
impulse Vector3
position 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

body Rid
torque Vector3

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

body Rid
impulse Vector3

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

body Rid
id ulong

BodyClearShapes(Rid)

Removes all shapes from a body.

public static void BodyClearShapes(Rid body)

Parameters

body Rid

BodyCreate()

public static Rid BodyCreate()

Returns

Rid

BodyGetCollisionLayer(Rid)

Returns the physics layer or layers a body belongs to.

public static uint BodyGetCollisionLayer(Rid body)

Parameters

body Rid

Returns

uint

BodyGetCollisionMask(Rid)

Returns the physics layer or layers a body can collide with.

public static uint BodyGetCollisionMask(Rid body)

Parameters

body Rid

Returns

uint

BodyGetCollisionPriority(Rid)

Returns the body's collision priority.

public static float BodyGetCollisionPriority(Rid body)

Parameters

body Rid

Returns

float

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

Vector3

BodyGetConstantTorque(Rid)

Returns the body's total constant rotational forces applied during each physics update.

See BodyAddConstantTorque(Rid, Vector3).

public static Vector3 BodyGetConstantTorque(Rid body)

Parameters

body Rid

Returns

Vector3

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

PhysicsDirectBodyState3D

BodyGetMaxContactsReported(Rid)

Returns the maximum contacts that can be reported. See BodySetMaxContactsReported(Rid, int).

public static int BodyGetMaxContactsReported(Rid body)

Parameters

body Rid

Returns

int

BodyGetMode(Rid)

Returns the body mode.

public static PhysicsServer3D.BodyMode BodyGetMode(Rid body)

Parameters

body Rid

Returns

PhysicsServer3D.BodyMode

BodyGetObjectInstanceId(Rid)

Gets the instance ID of the object the area is assigned to.

public static ulong BodyGetObjectInstanceId(Rid body)

Parameters

body Rid

Returns

ulong

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 Rid
param PhysicsServer3D.BodyParameter

Returns

Variant

BodyGetShape(Rid, int)

Returns the Rid of the nth shape of a body.

public static Rid BodyGetShape(Rid body, int shapeIdx)

Parameters

body Rid
shapeIdx int

Returns

Rid

BodyGetShapeCount(Rid)

Returns the number of shapes assigned to a body.

public static int BodyGetShapeCount(Rid body)

Parameters

body Rid

Returns

int

BodyGetShapeTransform(Rid, int)

Returns the transform matrix of a body shape.

public static Transform3D BodyGetShapeTransform(Rid body, int shapeIdx)

Parameters

body Rid
shapeIdx int

Returns

Transform3D

BodyGetSpace(Rid)

Returns the Rid of the space assigned to a body.

public static Rid BodyGetSpace(Rid body)

Parameters

body Rid

Returns

Rid

BodyGetState(Rid, BodyState)

Returns a body state.

public static Variant BodyGetState(Rid body, PhysicsServer3D.BodyState state)

Parameters

body Rid
state PhysicsServer3D.BodyState

Returns

Variant

BodyIsAxisLocked(Rid, BodyAxis)

public static bool BodyIsAxisLocked(Rid body, PhysicsServer3D.BodyAxis axis)

Parameters

body Rid
axis PhysicsServer3D.BodyAxis

Returns

bool

BodyIsContinuousCollisionDetectionEnabled(Rid)

If true, the continuous collision detection mode is enabled.

public static bool BodyIsContinuousCollisionDetectionEnabled(Rid body)

Parameters

body Rid

Returns

bool

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

bool

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

body Rid
exceptedBody Rid

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

body Rid
shapeIdx int

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 Rid
axis PhysicsServer3D.BodyAxis
lock 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

body Rid
axisVelocity Vector3

BodySetCollisionLayer(Rid, uint)

Sets the physics layer or layers a body belongs to.

public static void BodySetCollisionLayer(Rid body, uint layer)

Parameters

body Rid
layer uint

BodySetCollisionMask(Rid, uint)

Sets the physics layer or layers a body can collide with.

public static void BodySetCollisionMask(Rid body, uint mask)

Parameters

body Rid
mask uint

BodySetCollisionPriority(Rid, float)

Sets the body's collision priority.

public static void BodySetCollisionPriority(Rid body, float priority)

Parameters

body Rid
priority float

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

body Rid
force Vector3

BodySetConstantTorque(Rid, Vector3)

Sets the body's total constant rotational forces applied during each physics update.

See BodyAddConstantTorque(Rid, Vector3).

public static void BodySetConstantTorque(Rid body, Vector3 torque)

Parameters

body Rid
torque Vector3

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

body Rid
enable bool

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:

- statePhysicsDirectBodyState3D 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

body Rid
callable Callable
userdata Variant

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

body Rid
amount int

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 Rid
mode 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

body Rid
enable bool

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 Rid
param PhysicsServer3D.BodyParameter
value Variant

BodySetRayPickable(Rid, bool)

Sets the body pickable with rays if enable is set.

public static void BodySetRayPickable(Rid body, bool enable)

Parameters

body Rid
enable bool

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

body Rid
shapeIdx int
shape Rid

BodySetShapeDisabled(Rid, int, bool)

public static void BodySetShapeDisabled(Rid body, int shapeIdx, bool disabled)

Parameters

body Rid
shapeIdx int
disabled bool

BodySetShapeTransform(Rid, int, Transform3D)

Sets the transform matrix for a body shape.

public static void BodySetShapeTransform(Rid body, int shapeIdx, Transform3D transform)

Parameters

body Rid
shapeIdx int
transform Transform3D

BodySetSpace(Rid, Rid)

Assigns a space to the body (see SpaceCreate()).

public static void BodySetSpace(Rid body, Rid space)

Parameters

body Rid
space Rid

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 Rid
state PhysicsServer3D.BodyState
value 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 Rid
parameters PhysicsTestMotionParameters3D
result PhysicsTestMotionResult3D

Returns

bool

BoxShapeCreate()

public static Rid BoxShapeCreate()

Returns

Rid

CapsuleShapeCreate()

public static Rid CapsuleShapeCreate()

Returns

Rid

ConcavePolygonShapeCreate()

public static Rid ConcavePolygonShapeCreate()

Returns

Rid

ConeTwistJointGetParam(Rid, ConeTwistJointParam)

Gets a cone_twist_joint parameter (see PhysicsServer3D.ConeTwistJointParam constants).

public static float ConeTwistJointGetParam(Rid joint, PhysicsServer3D.ConeTwistJointParam param)

Parameters

joint Rid
param PhysicsServer3D.ConeTwistJointParam

Returns

float

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 Rid
param PhysicsServer3D.ConeTwistJointParam
value float

ConvexPolygonShapeCreate()

public static Rid ConvexPolygonShapeCreate()

Returns

Rid

CustomShapeCreate()

public static Rid CustomShapeCreate()

Returns

Rid

CylinderShapeCreate()

public static Rid CylinderShapeCreate()

Returns

Rid

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 Rid
axis Vector3.Axis
flag PhysicsServer3D.G6DofJointAxisFlag

Returns

bool

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 Rid
axis Vector3.Axis
param PhysicsServer3D.G6DofJointAxisParam

Returns

float

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 Rid
axis Vector3.Axis
flag PhysicsServer3D.G6DofJointAxisFlag
enable 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 Rid
axis Vector3.Axis
param PhysicsServer3D.G6DofJointAxisParam
value 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

int

HeightmapShapeCreate()

public static Rid HeightmapShapeCreate()

Returns

Rid

HingeJointGetFlag(Rid, HingeJointFlag)

Gets a hinge_joint flag (see PhysicsServer3D.HingeJointFlag constants).

public static bool HingeJointGetFlag(Rid joint, PhysicsServer3D.HingeJointFlag flag)

Parameters

joint Rid
flag PhysicsServer3D.HingeJointFlag

Returns

bool

HingeJointGetParam(Rid, HingeJointParam)

Gets a hinge_joint parameter (see PhysicsServer3D.HingeJointParam).

public static float HingeJointGetParam(Rid joint, PhysicsServer3D.HingeJointParam param)

Parameters

joint Rid
param PhysicsServer3D.HingeJointParam

Returns

float

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 Rid
flag PhysicsServer3D.HingeJointFlag
enabled 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 Rid
param PhysicsServer3D.HingeJointParam
value float

JointClear(Rid)

public static void JointClear(Rid joint)

Parameters

joint Rid

JointCreate()

public static Rid JointCreate()

Returns

Rid

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

joint Rid
disable bool

JointGetSolverPriority(Rid)

Gets the priority value of the Joint3D.

public static int JointGetSolverPriority(Rid joint)

Parameters

joint Rid

Returns

int

JointGetType(Rid)

Returns the type of the Joint3D.

public static PhysicsServer3D.JointType JointGetType(Rid joint)

Parameters

joint Rid

Returns

PhysicsServer3D.JointType

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

bool

JointMakeConeTwist(Rid, Rid, Transform3D, Rid, Transform3D)

public static void JointMakeConeTwist(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)

Parameters

joint Rid
bodyA Rid
localRefA Transform3D
bodyB Rid
localRefB Transform3D

JointMakeGeneric6Dof(Rid, Rid, Transform3D, Rid, Transform3D)

public static void JointMakeGeneric6Dof(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)

Parameters

joint Rid
bodyA Rid
localRefA Transform3D
bodyB Rid
localRefB Transform3D

JointMakeHinge(Rid, Rid, Transform3D, Rid, Transform3D)

public static void JointMakeHinge(Rid joint, Rid bodyA, Transform3D hingeA, Rid bodyB, Transform3D hingeB)

Parameters

joint Rid
bodyA Rid
hingeA Transform3D
bodyB Rid
hingeB Transform3D

JointMakePin(Rid, Rid, Vector3, Rid, Vector3)

public static void JointMakePin(Rid joint, Rid bodyA, Vector3 localA, Rid bodyB, Vector3 localB)

Parameters

joint Rid
bodyA Rid
localA Vector3
bodyB Rid
localB Vector3

JointMakeSlider(Rid, Rid, Transform3D, Rid, Transform3D)

public static void JointMakeSlider(Rid joint, Rid bodyA, Transform3D localRefA, Rid bodyB, Transform3D localRefB)

Parameters

joint Rid
bodyA Rid
localRefA Transform3D
bodyB Rid
localRefB Transform3D

JointSetSolverPriority(Rid, int)

Sets the priority value of the Joint3D.

public static void JointSetSolverPriority(Rid joint, int priority)

Parameters

joint Rid
priority int

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

Vector3

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

Vector3

PinJointGetParam(Rid, PinJointParam)

Gets a pin_joint parameter (see PhysicsServer3D.PinJointParam constants).

public static float PinJointGetParam(Rid joint, PhysicsServer3D.PinJointParam param)

Parameters

joint Rid
param PhysicsServer3D.PinJointParam

Returns

float

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

joint Rid
localA Vector3

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

joint Rid
localB Vector3

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 Rid
param PhysicsServer3D.PinJointParam
value float

SeparationRayShapeCreate()

public static Rid SeparationRayShapeCreate()

Returns

Rid

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

Variant

ShapeGetType(Rid)

Returns the type of shape (see PhysicsServer3D.ShapeType constants).

public static PhysicsServer3D.ShapeType ShapeGetType(Rid shape)

Parameters

shape Rid

Returns

PhysicsServer3D.ShapeType

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

shape Rid
data Variant

SliderJointGetParam(Rid, SliderJointParam)

Gets a slider_joint parameter (see PhysicsServer3D.SliderJointParam constants).

public static float SliderJointGetParam(Rid joint, PhysicsServer3D.SliderJointParam param)

Parameters

joint Rid
param PhysicsServer3D.SliderJointParam

Returns

float

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 Rid
param PhysicsServer3D.SliderJointParam
value float

SoftBodyGetBounds(Rid)

public static Aabb SoftBodyGetBounds(Rid body)

Parameters

body Rid

Returns

Aabb

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

Rid

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

PhysicsDirectSpaceState3D

SpaceGetParam(Rid, SpaceParameter)

Returns the value of a space parameter.

public static float SpaceGetParam(Rid space, PhysicsServer3D.SpaceParameter param)

Parameters

space Rid
param PhysicsServer3D.SpaceParameter

Returns

float

SpaceIsActive(Rid)

Returns whether the space is active.

public static bool SpaceIsActive(Rid space)

Parameters

space Rid

Returns

bool

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

space Rid
active bool

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 Rid
param PhysicsServer3D.SpaceParameter
value float

SphereShapeCreate()

public static Rid SphereShapeCreate()

Returns

Rid

WorldBoundaryShapeCreate()

public static Rid WorldBoundaryShapeCreate()

Returns

Rid