Struct PhysicsServerSingleton

Server interface for low-level physics access.

struct PhysicsServerSingleton ;

PhysicsServer is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree.

Methods

NameDescription
areaAddShape 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 Assigns the area to a descendant of GodotObject, so it can exist in the node tree.
areaClearShapes Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
areaCreate Creates an Area.
areaGetObjectInstanceId Gets the instance ID of the object the area is assigned to.
areaGetParam Returns an area parameter value. A list of available parameters is on the areaparameter constants.
areaGetShape Returns the RID of the nth shape of an area.
areaGetShapeCount Returns the number of shapes assigned to an area.
areaGetShapeTransform Returns the transform matrix of a shape within an area.
areaGetSpace Returns the space assigned to the area.
areaGetSpaceOverrideMode Returns the space override mode for the area.
areaGetTransform Returns the transform matrix for an area.
areaIsRayPickable If true, area collides with rays.
areaRemoveShape Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
areaSetAreaMonitorCallback
areaSetCollisionLayer Assigns the area to one or many physics layers.
areaSetCollisionMask Sets which physics layers the area will monitor.
areaSetMonitorable
areaSetMonitorCallback 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: constant AREA_BODY_ADDED or constant 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.
areaSetParam Sets the value for an area parameter. A list of available parameters is on the areaparameter constants.
areaSetRayPickable Sets object pickable with rays.
areaSetShape Substitutes a given area shape by another. The old shape is selected by its index, the new one by its RID.
areaSetShapeDisabled
areaSetShapeTransform Sets the transform matrix for an area shape.
areaSetSpace Assigns a space to the area.
areaSetSpaceOverrideMode Sets the space override mode for the area. The modes are described in the areaspaceoverridemode constants.
areaSetTransform Sets the transform matrix for an area.
bodyAddCentralForce
bodyAddCollisionException Adds a body to the list of bodies exempt from collisions.
bodyAddForce
bodyAddShape 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
bodyApplyCentralImpulse
bodyApplyImpulse Gives the body a push at a position in the direction of the impulse.
bodyApplyTorqueImpulse Gives the body a push to rotate it.
bodyAttachObjectInstanceId Assigns the area to a descendant of GodotObject, so it can exist in the node tree.
bodyClearShapes Removes all shapes from a body.
bodyCreate Creates a physics body. The first parameter can be any value from bodymode constants, for the type of body created. Additionally, the body can be created in sleeping state to save processing time.
bodyGetCollisionLayer Returns the physics layer or layers a body belongs to.
bodyGetCollisionMask Returns the physics layer or layers a body can collide with. -
bodyGetDirectState Returns the PhysicsDirectBodyState of the body.
bodyGetKinematicSafeMargin
bodyGetMaxContactsReported Returns the maximum contacts that can be reported. See bodySetMaxContactsReported.
bodyGetMode Returns the body mode.
bodyGetObjectInstanceId Gets the instance ID of the object the area is assigned to.
bodyGetParam Returns the value of a body parameter. A list of available parameters is on the bodyparameter constants.
bodyGetShape Returns the RID of the nth shape of a body.
bodyGetShapeCount Returns the number of shapes assigned to a body.
bodyGetShapeTransform Returns the transform matrix of a body shape.
bodyGetSpace Returns the RID of the space assigned to a body.
bodyGetState Returns a body state.
bodyIsAxisLocked
bodyIsContinuousCollisionDetectionEnabled If true, the continuous collision detection mode is enabled.
bodyIsOmittingForceIntegration Returns whether a body uses a callback function to calculate its own physics (see bodySetForceIntegrationCallback).
bodyIsRayPickable If true, the body can be detected by rays.
bodyRemoveCollisionException 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 Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
bodySetAxisLock
bodySetAxisVelocity 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 Sets the physics layer or layers a body belongs to.
bodySetCollisionMask Sets the physics layer or layers a body can collide with.
bodySetEnableContinuousCollisionDetection 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 Sets the function used to calculate physics for an object, if that object allows it (see bodySetOmitForceIntegration).
bodySetKinematicSafeMargin
bodySetMaxContactsReported 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 Sets the body mode, from one of the bodymode constants.
bodySetOmitForceIntegration Sets whether a body uses a callback function to calculate its own physics (see bodySetForceIntegrationCallback).
bodySetParam Sets a body parameter. A list of available parameters is on the bodyparameter constants.
bodySetRayPickable Sets the body pickable with rays if enabled is set.
bodySetShape Substitutes a given body shape by another. The old shape is selected by its index, the new one by its RID.
bodySetShapeDisabled
bodySetShapeTransform Sets the transform matrix for a body shape.
bodySetSpace Assigns a space to the body (see spaceCreate).
bodySetState Sets a body state (see bodystate constants).
coneTwistJointGetParam Gets a cone_twist_joint parameter (see conetwistjointparam constants).
coneTwistJointSetParam Sets a cone_twist_joint parameter (see conetwistjointparam constants).
freeRid 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 Gets a generic_6_DOF_joint flag (see g6dofjointaxisflag constants).
generic6dofJointGetParam Gets a generic_6_DOF_joint parameter (see g6dofjointaxisparam constants).
generic6dofJointSetFlag Sets a generic_6_DOF_joint flag (see g6dofjointaxisflag constants).
generic6dofJointSetParam Sets a generic_6_DOF_joint parameter (see g6dofjointaxisparam constants).
getProcessInfo Returns an Info defined by the processinfo input given.
hingeJointGetFlag Gets a hinge_joint flag (see hingejointflag constants).
hingeJointGetParam Gets a hinge_joint parameter (see hingejointparam).
hingeJointSetFlag Sets a hinge_joint flag (see hingejointflag constants).
hingeJointSetParam Sets a hinge_joint parameter (see hingejointparam constants).
jointCreateConeTwist Creates a ConeTwistJoint.
jointCreateGeneric6dof Creates a Generic6DOFJoint.
jointCreateHinge Creates a HingeJoint.
jointCreatePin Creates a PinJoint.
jointCreateSlider Creates a SliderJoint.
jointGetSolverPriority Gets the priority value of the Joint.
jointGetType Returns the type of the Joint.
jointSetSolverPriority Sets the priority value of the Joint.
pinJointGetLocalA Returns position of the joint in the local space of body a of the joint.
pinJointGetLocalB Returns position of the joint in the local space of body b of the joint.
pinJointGetParam Gets a pin_joint parameter (see pinjointparam constants).
pinJointSetLocalA Sets position of the joint in the local space of body a of the joint.
pinJointSetLocalB Sets position of the joint in the local space of body b of the joint.
pinJointSetParam Sets a pin_joint parameter (see pinjointparam constants).
setActive Activates or deactivates the 3D physics engine.
shapeCreate Creates a shape of a type from shapetype. Does not assign it to a body or an area. To do so, you must use areaSetShape or bodySetShape.
shapeGetData Returns the shape data.
shapeGetType Returns the type of shape (see shapetype constants).
shapeSetData Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created shapeGetType.
sliderJointGetParam Gets a slider_joint parameter (see sliderjointparam constants).
sliderJointSetParam Gets a slider_joint parameter (see sliderjointparam constants).
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 Returns the state of a space, a PhysicsDirectSpaceState. This object can be used to make collision/intersection queries.
spaceGetParam Returns the value of a space parameter.
spaceIsActive Returns whether the space is active.
spaceSetActive Marks a space as active. It will not have an effect, unless it is assigned to an area or body.
spaceSetParam Sets the value for a space parameter. A list of available parameters is on the spaceparameter constants.

Enums

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