PhysicsServerSingleton

Server interface for low level physics access.

Everything related to physics in 3D.

@GodotBaseClass
struct PhysicsServerSingleton {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

AreaBodyStatus
enum AreaBodyStatus
AreaParameter
enum AreaParameter
AreaSpaceOverrideMode
enum AreaSpaceOverrideMode
BodyAxis
enum BodyAxis
BodyMode
enum BodyMode
BodyParameter
enum BodyParameter
BodyState
enum BodyState
ConeTwistJointParam
enum ConeTwistJointParam
Constants
enum Constants
G6DOFJointAxisFlag
enum G6DOFJointAxisFlag
G6DOFJointAxisParam
enum G6DOFJointAxisParam
HingeJointFlag
enum HingeJointFlag
HingeJointParam
enum HingeJointParam
JointType
enum JointType
PinJointParam
enum PinJointParam
ProcessInfo
enum ProcessInfo
ShapeType
enum ShapeType
SliderJointParam
enum SliderJointParam
SpaceParameter
enum SpaceParameter

Functions

areaAddShape
void areaAddShape(RID area, RID shape, Transform transform)

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.

areaAttachObjectInstanceId
void areaAttachObjectInstanceId(RID area, long id)

Assigns the area to a descendant of GodotObject, so it can exist in the node tree.

areaClearShapes
void areaClearShapes(RID area)

Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.

areaCreate
RID areaCreate()

Creates an Area.

areaGetObjectInstanceId
long areaGetObjectInstanceId(RID area)

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

areaGetParam
Variant areaGetParam(RID area, long param)

Returns an area parameter value. A list of available parameters is on the AREA_PARAM_* constants.

areaGetShape
RID areaGetShape(RID area, long shape_idx)

Returns the RID of the nth shape of an area.

areaGetShapeCount
long areaGetShapeCount(RID area)

Returns the number of shapes assigned to an area.

areaGetShapeTransform
Transform areaGetShapeTransform(RID area, long shape_idx)

Returns the transform matrix of a shape within an area.

areaGetSpace
RID areaGetSpace(RID area)

Returns the space assigned to the area.

areaGetSpaceOverrideMode
PhysicsServer.AreaSpaceOverrideMode areaGetSpaceOverrideMode(RID area)

Returns the space override mode for the area.

areaGetTransform
Transform areaGetTransform(RID area)

Returns the transform matrix for an area.

areaIsRayPickable
bool areaIsRayPickable(RID area)

If true area collides with rays.

areaRemoveShape
void areaRemoveShape(RID area, long shape_idx)

Removes a shape from an area. It does not delete the shape, so it can be reassigned later.

areaSetAreaMonitorCallback
void areaSetAreaMonitorCallback(RID area, GodotObject receiver, StringArg2 method)
areaSetCollisionLayer
void areaSetCollisionLayer(RID area, long layer)

Assigns the area to one or many physics layers.

areaSetCollisionMask
void areaSetCollisionMask(RID area, long mask)

Sets which physics layers the area will monitor.

areaSetMonitorCallback
void areaSetMonitorCallback(RID area, GodotObject receiver, StringArg2 method)

Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: 1: AREA_BODY_ADDED or AREA_BODY_REMOVED, depending on whether the object entered or exited the area. 2: RID of the object that entered/exited the area. 3: Instance ID of the object that entered/exited the area. 4: The shape index of the object that entered/exited the area. 5: The shape index of the area where the object entered/exited.

areaSetMonitorable
void areaSetMonitorable(RID area, bool monitorable)
areaSetParam
void areaSetParam(RID area, long param, VariantArg2 value)

Sets the value for an area parameter. A list of available parameters is on the AREA_PARAM_* constants.

areaSetRayPickable
void areaSetRayPickable(RID area, bool enable)

Sets object pickable with rays.

areaSetShape
void areaSetShape(RID area, long shape_idx, RID shape)

Substitutes a given area shape by another. The old shape is selected by its index, the new one by its RID.

areaSetShapeTransform
void areaSetShapeTransform(RID area, long shape_idx, Transform transform)

Sets the transform matrix for an area shape.

areaSetSpace
void areaSetSpace(RID area, RID space)

Assigns a space to the area.

areaSetSpaceOverrideMode
void areaSetSpaceOverrideMode(RID area, long mode)

Sets the space override mode for the area. The modes are described in the constants AREA_SPACE_OVERRIDE_*.

areaSetTransform
void areaSetTransform(RID area, Transform transform)

Sets the transform matrix for an area.

bodyAddCentralForce
void bodyAddCentralForce(RID _body, Vector3 force)
bodyAddCollisionException
void bodyAddCollisionException(RID _body, RID excepted_body)

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

bodyAddForce
void bodyAddForce(RID _body, Vector3 force, Vector3 position)
bodyAddShape
void bodyAddShape(RID _body, RID shape, Transform transform)

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.

bodyAddTorque
void bodyAddTorque(RID _body, Vector3 torque)
bodyApplyCentralImpulse
void bodyApplyCentralImpulse(RID _body, Vector3 impulse)
bodyApplyImpulse
void bodyApplyImpulse(RID _body, Vector3 position, Vector3 impulse)

Gives the body a push at a position in the direction of the impulse.

bodyApplyTorqueImpulse
void bodyApplyTorqueImpulse(RID _body, Vector3 impulse)

Gives the body a push to rotate it.

bodyAttachObjectInstanceId
void bodyAttachObjectInstanceId(RID _body, long id)

Assigns the area to a descendant of GodotObject, so it can exist in the node tree.

bodyClearShapes
void bodyClearShapes(RID _body)

Removes all shapes from a body.

bodyCreate
RID bodyCreate(long mode, bool init_sleeping)

Creates a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time.

bodyGetCollisionLayer
long bodyGetCollisionLayer(RID _body)

Returns the physics layer or layers a body belongs to.

bodyGetCollisionMask
long bodyGetCollisionMask(RID _body)

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

bodyGetDirectState
PhysicsDirectBodyState bodyGetDirectState(RID _body)

Returns the PhysicsDirectBodyState of the body.

bodyGetKinematicSafeMargin
double bodyGetKinematicSafeMargin(RID _body)
bodyGetMaxContactsReported
long bodyGetMaxContactsReported(RID _body)

Returns the maximum contacts that can be reported. See bodySetMaxContactsReported.

bodyGetMode
PhysicsServer.BodyMode bodyGetMode(RID _body)

Returns the body mode.

bodyGetObjectInstanceId
long bodyGetObjectInstanceId(RID _body)

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

bodyGetParam
double bodyGetParam(RID _body, long param)

Returns the value of a body parameter. A list of available parameters is on the BODY_PARAM_* constants.

bodyGetShape
RID bodyGetShape(RID _body, long shape_idx)

Returns the RID of the nth shape of a body.

bodyGetShapeCount
long bodyGetShapeCount(RID _body)

Returns the number of shapes assigned to a body.

bodyGetShapeTransform
Transform bodyGetShapeTransform(RID _body, long shape_idx)

Returns the transform matrix of a body shape.

bodyGetSpace
RID bodyGetSpace(RID _body)

Returns the RID of the space assigned to a body.

bodyGetState
Variant bodyGetState(RID _body, long state)

Returns a body state.

bodyIsAxisLocked
bool bodyIsAxisLocked(RID _body, long axis)
bodyIsContinuousCollisionDetectionEnabled
bool bodyIsContinuousCollisionDetectionEnabled(RID _body)

If true the continuous collision detection mode is enabled.

bodyIsOmittingForceIntegration
bool bodyIsOmittingForceIntegration(RID _body)

Returns whether a body uses a callback function to calculate its own physics (see bodySetForceIntegrationCallback).

bodyIsRayPickable
bool bodyIsRayPickable(RID _body)

If true the body can be detected by rays

bodyRemoveCollisionException
void bodyRemoveCollisionException(RID _body, RID excepted_body)

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.

bodyRemoveShape
void bodyRemoveShape(RID _body, long shape_idx)

Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.

bodySetAxisLock
void bodySetAxisLock(RID _body, long axis, bool lock)
bodySetAxisVelocity
void bodySetAxisVelocity(RID _body, Vector3 axis_velocity)

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.

bodySetCollisionLayer
void bodySetCollisionLayer(RID _body, long layer)

Sets the physics layer or layers a body belongs to.

bodySetCollisionMask
void bodySetCollisionMask(RID _body, long mask)

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

bodySetEnableContinuousCollisionDetection
void bodySetEnableContinuousCollisionDetection(RID _body, bool enable)

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.

bodySetForceIntegrationCallback
void bodySetForceIntegrationCallback(RID _body, GodotObject receiver, StringArg2 method, VariantArg3 userdata)

Sets the function used to calculate physics for an object, if that object allows it (see bodySetOmitForceIntegration).

bodySetKinematicSafeMargin
void bodySetKinematicSafeMargin(RID _body, double margin)
bodySetMaxContactsReported
void bodySetMaxContactsReported(RID _body, long amount)

Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.

bodySetMode
void bodySetMode(RID _body, long mode)

Sets the body mode, from one of the constants BODY_MODE*.

bodySetOmitForceIntegration
void bodySetOmitForceIntegration(RID _body, bool enable)

Sets whether a body uses a callback function to calculate its own physics (see bodySetForceIntegrationCallback).

bodySetParam
void bodySetParam(RID _body, long param, double value)

Sets a body parameter. A list of available parameters is on the BODY_PARAM_* constants.

bodySetRayPickable
void bodySetRayPickable(RID _body, bool enable)

Sets the body pickable with rays if enabled is set.

bodySetShape
void bodySetShape(RID _body, long shape_idx, RID shape)

Substitutes a given body shape by another. The old shape is selected by its index, the new one by its RID.

bodySetShapeTransform
void bodySetShapeTransform(RID _body, long shape_idx, Transform transform)

Sets the transform matrix for a body shape.

bodySetSpace
void bodySetSpace(RID _body, RID space)

Assigns a space to the body (see createSpace).

bodySetState
void bodySetState(RID _body, long state, VariantArg2 value)

Sets a body state (see BODY_STATE* constants).

coneTwistJointGetParam
double coneTwistJointGetParam(RID joint, long param)

Gets a cone_twist_joint parameter (see CONE_TWIST_JOINT* constants).

coneTwistJointSetParam
void coneTwistJointSetParam(RID joint, long param, double value)

Sets a cone_twist_joint parameter (see CONE_TWIST_JOINT* constants).

freeRid
void freeRid(RID rid)

Destroys any of the objects created by PhysicsServer. If the RID passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console.

generic6dofJointGetFlag
bool generic6dofJointGetFlag(RID joint, long axis, long flag)

Gets a generic_6_DOF_joint flag (see G6DOF_JOINT_FLAG* constants).

generic6dofJointGetParam
double generic6dofJointGetParam(RID joint, long axis, long param)

Gets a generic_6_DOF_joint parameter (see G6DOF_JOINT* constants without the G6DOF_JOINT_FLAG*).

generic6dofJointSetFlag
void generic6dofJointSetFlag(RID joint, long axis, long flag, bool enable)

Sets a generic_6_DOF_joint flag (see G6DOF_JOINT_FLAG* constants).

generic6dofJointSetParam
void generic6dofJointSetParam(RID joint, long axis, long param, double value)

Sets a generic_6_DOF_joint parameter (see G6DOF_JOINT* constants without the G6DOF_JOINT_FLAG*).

getProcessInfo
long getProcessInfo(long process_info)

Returns an Info defined by the ProcessInfo input given.

hingeJointGetFlag
bool hingeJointGetFlag(RID joint, long flag)

Gets a hinge_joint flag (see HINGE_JOINT_FLAG* constants).

hingeJointGetParam
double hingeJointGetParam(RID joint, long param)

Gets a hinge_joint parameter (see HINGE_JOINT* constants without the HINGE_JOINT_FLAG*).

hingeJointSetFlag
void hingeJointSetFlag(RID joint, long flag, bool enabled)

Sets a hinge_joint flag (see HINGE_JOINT_FLAG* constants).

hingeJointSetParam
void hingeJointSetParam(RID joint, long param, double value)

Sets a hinge_joint parameter (see HINGE_JOINT* constants without the HINGE_JOINT_FLAG*).

jointCreateConeTwist
RID jointCreateConeTwist(RID body_A, Transform local_ref_A, RID body_B, Transform local_ref_B)

Creates a ConeTwistJoint.

jointCreateGeneric6dof
RID jointCreateGeneric6dof(RID body_A, Transform local_ref_A, RID body_B, Transform local_ref_B)

Creates a Generic6DOFJoint.

jointCreateHinge
RID jointCreateHinge(RID body_A, Transform hinge_A, RID body_B, Transform hinge_B)

Creates a HingeJoint.

jointCreatePin
RID jointCreatePin(RID body_A, Vector3 local_A, RID body_B, Vector3 local_B)

Creates a PinJoint.

jointCreateSlider
RID jointCreateSlider(RID body_A, Transform local_ref_A, RID body_B, Transform local_ref_B)

Creates a SliderJoint.

jointGetSolverPriority
long jointGetSolverPriority(RID joint)

Gets the priority value of the Joint.

jointGetType
PhysicsServer.JointType jointGetType(RID joint)

Returns the type of the Joint.

jointSetSolverPriority
void jointSetSolverPriority(RID joint, long priority)

Sets the priority value of the Joint.

opAssign
PhysicsServerSingleton opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(PhysicsServerSingleton other)
Undocumented in source. Be warned that the author may not have intended to support it.
pinJointGetLocalA
Vector3 pinJointGetLocalA(RID joint)

Returns position of the joint in the local space of body a of the joint.

pinJointGetLocalB
Vector3 pinJointGetLocalB(RID joint)

Returns position of the joint in the local space of body b of the joint.

pinJointGetParam
double pinJointGetParam(RID joint, long param)

Gets a pin_joint parameter (see PIN_JOINT* constants).

pinJointSetLocalA
void pinJointSetLocalA(RID joint, Vector3 local_A)

Sets position of the joint in the local space of body a of the joint.

pinJointSetLocalB
void pinJointSetLocalB(RID joint, Vector3 local_B)

Sets position of the joint in the local space of body b of the joint.

pinJointSetParam
void pinJointSetParam(RID joint, long param, double value)

Sets a pin_joint parameter (see PIN_JOINT* constants).

setActive
void setActive(bool active)

Activates or deactivates the 3D physics engine.

shapeCreate
RID shapeCreate(long type)

Creates a shape of type SHAPE_*. Does not assign it to a body or an area. To do so, you must use areaSetShape or bodySetShape.

shapeGetData
Variant shapeGetData(RID shape)

Returns the shape data.

shapeGetType
PhysicsServer.ShapeType shapeGetType(RID shape)

Returns the type of shape (see SHAPE_* constants).

shapeSetData
void shapeSetData(RID shape, VariantArg1 data)

Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created shapeGetType.

sliderJointGetParam
double sliderJointGetParam(RID joint, long param)

Gets a slider_joint parameter (see SLIDER_JOINT* constants).

sliderJointSetParam
void sliderJointSetParam(RID joint, long param, double value)

Gets a slider_joint parameter (see SLIDER_JOINT* constants).

spaceCreate
RID 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, or to a body with bodySetSpace.

spaceGetDirectState
PhysicsDirectSpaceState spaceGetDirectState(RID space)

Returns the state of a space, a PhysicsDirectSpaceState. This object can be used to make collision/intersection queries.

spaceGetParam
double spaceGetParam(RID space, long param)

Returns the value of a space parameter.

spaceIsActive
bool spaceIsActive(RID space)

Returns whether the space is active.

spaceSetActive
void spaceSetActive(RID space, bool active)

Marks a space as active. It will not have an effect, unless it is assigned to an area or body.

spaceSetParam
void spaceSetParam(RID space, long param, double value)

Sets the value for a space parameter. A list of available parameters is on the SPACE_PARAM_* constants.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
PhysicsServerSingleton _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta