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.
Static variables
Static methods
staticareaAddShape(area:RID, shape:RID, ?transform:Transform, ?disabled:Bool):Void
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.
Parameters:
transform | If the parameter is null, then the default value is Transform.Identity |
---|
staticareaAttachObjectInstanceId(area:RID, id:UInt64):Void
Assigns the area to a descendant of godot.Object
, so it can exist in the node tree.
staticareaClearShapes(area:RID):Void
Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.
staticareaGetObjectInstanceId(area:RID):UInt64
Gets the instance ID of the object the area is assigned to.
staticareaGetParam(area:RID, param:PhysicsServer_AreaParameter):Dynamic
Returns an area parameter value. A list of available parameters is on the godot.PhysicsServer_AreaParameter
constants.
staticareaGetShapeTransform(area:RID, shapeIdx:Int):Transform
Returns the transform matrix of a shape within an area.
staticareaGetSpaceOverrideMode(area:RID):PhysicsServer_AreaSpaceOverrideMode
Returns the space override mode for the area.
staticareaRemoveShape(area:RID, shapeIdx:Int):Void
Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
staticareaSetCollisionLayer(area:RID, layer:UInt):Void
Assigns the area to one or many physics layers.
staticareaSetCollisionMask(area:RID, mask:UInt):Void
Sets which physics layers the area will monitor.
staticareaSetMonitorCallback(area:RID, receiver:Object, method:String):Void
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: godot.PhysicsServer_AreaBodyStatus.added
or godot.PhysicsServer_AreaBodyStatus.removed
, depending on whether the object entered or exited the area.
2: godot.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.
staticareaSetParam(area:RID, param:PhysicsServer_AreaParameter, value:Dynamic):Void
Sets the value for an area parameter. A list of available parameters is on the godot.PhysicsServer_AreaParameter
constants.
staticareaSetShape(area:RID, shapeIdx:Int, shape:RID):Void
Substitutes a given area shape by another. The old shape is selected by its index, the new one by its godot.RID
.
staticareaSetShapeTransform(area:RID, shapeIdx:Int, transform:Transform):Void
Sets the transform matrix for an area shape.
staticareaSetSpaceOverrideMode(area:RID, mode:PhysicsServer_AreaSpaceOverrideMode):Void
Sets the space override mode for the area. The modes are described in the godot.PhysicsServer_AreaSpaceOverrideMode
constants.
staticbodyAddCollisionException(body:RID, exceptedBody:RID):Void
Adds a body to the list of bodies exempt from collisions.
staticbodyAddShape(body:RID, shape:RID, ?transform:Transform, ?disabled:Bool):Void
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.
Parameters:
transform | If the parameter is null, then the default value is Transform.Identity |
---|
staticbodyApplyImpulse(body:RID, position:Vector3, impulse:Vector3):Void
Gives the body a push at a position
in the direction of the impulse
.
staticbodyAttachObjectInstanceId(body:RID, id:UInt):Void
Assigns the area to a descendant of godot.Object
, so it can exist in the node tree.
staticbodyCreate(?mode:PhysicsServer_BodyMode, ?initSleeping:Bool):RID
Creates a physics body. The first parameter can be any value from godot.PhysicsServer_BodyMode
constants, for the type of body created. Additionally, the body can be created in sleeping state to save processing time.
staticbodyGetCollisionMask(body:RID):UInt
Returns the physics layer or layers a body can collide with.
staticbodyGetDirectState(body:RID):PhysicsDirectBodyState
Returns the godot.PhysicsDirectBodyState
of the body. Returns null
if the body is destroyed or removed from the physics space.
staticbodyGetMaxContactsReported(body:RID):Int
Returns the maximum contacts that can be reported. See godot.PhysicsServer.bodySetMaxContactsReported
.
staticbodyGetObjectInstanceId(body:RID):UInt
Gets the instance ID of the object the area is assigned to.
staticbodyGetParam(body:RID, param:PhysicsServer_BodyParameter):Single
Returns the value of a body parameter. A list of available parameters is on the godot.PhysicsServer_BodyParameter
constants.
staticbodyGetShapeTransform(body:RID, shapeIdx:Int):Transform
Returns the transform matrix of a body shape.
staticbodyIsContinuousCollisionDetectionEnabled(body:RID):Bool
If true
, the continuous collision detection mode is enabled.
staticbodyIsOmittingForceIntegration(body:RID):Bool
Returns whether a body uses a callback function to calculate its own physics (see godot.PhysicsServer.bodySetForceIntegrationCallback
).
staticbodyRemoveCollisionException(body:RID, exceptedBody:RID):Void
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.
staticbodyRemoveShape(body:RID, shapeIdx:Int):Void
Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.
staticbodySetAxisVelocity(body:RID, axisVelocity:Vector3):Void
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.
staticbodySetCollisionLayer(body:RID, layer:UInt):Void
Sets the physics layer or layers a body belongs to.
staticbodySetCollisionMask(body:RID, mask:UInt):Void
Sets the physics layer or layers a body can collide with.
staticbodySetEnableContinuousCollisionDetection(body:RID, enable:Bool):Void
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.
staticbodySetForceIntegrationCallback(body:RID, receiver:Object, method:String, ?userdata:Dynamic):Void
Sets the function used to calculate physics for an object, if that object allows it (see godot.PhysicsServer.bodySetOmitForceIntegration
).
staticbodySetMaxContactsReported(body:RID, amount:Int):Void
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.
staticbodySetMode(body:RID, mode:PhysicsServer_BodyMode):Void
Sets the body mode, from one of the godot.PhysicsServer_BodyMode
constants.
staticbodySetOmitForceIntegration(body:RID, enable:Bool):Void
Sets whether a body uses a callback function to calculate its own physics (see godot.PhysicsServer.bodySetForceIntegrationCallback
).
staticbodySetParam(body:RID, param:PhysicsServer_BodyParameter, value:Single):Void
Sets a body parameter. A list of available parameters is on the godot.PhysicsServer_BodyParameter
constants.
staticbodySetRayPickable(body:RID, enable:Bool):Void
Sets the body pickable with rays if enabled
is set.
staticbodySetShape(body:RID, shapeIdx:Int, shape:RID):Void
Substitutes a given body shape by another. The old shape is selected by its index, the new one by its godot.RID
.
staticbodySetShapeTransform(body:RID, shapeIdx:Int, transform:Transform):Void
Sets the transform matrix for a body shape.
staticbodySetSpace(body:RID, space:RID):Void
Assigns a space to the body (see godot.PhysicsServer.spaceCreate
).
staticbodySetState(body:RID, state:PhysicsServer_BodyState, value:Dynamic):Void
Sets a body state (see godot.PhysicsServer_BodyState
constants).
staticbodyTestMotion(body:RID, from:Transform, motion:Vector3, infiniteInertia:Bool, ?result:PhysicsTestMotionResult, ?excludeRaycastShapes:Bool, ?exclude:Array):Bool
Returns true
if a collision would result from moving in the given direction from a given point in space. godot.PhysicsTestMotionResult
can be passed to return additional information in.
Parameters:
exclude | If the parameter is null, then the default value is new Godot.Collections.Array { } |
---|
staticconeTwistJointGetParam(joint:RID, param:PhysicsServer_ConeTwistJointParam):Single
Gets a cone_twist_joint parameter (see godot.PhysicsServer_ConeTwistJointParam
constants).
staticconeTwistJointSetParam(joint:RID, param:PhysicsServer_ConeTwistJointParam, value:Single):Void
Sets a cone_twist_joint parameter (see godot.PhysicsServer_ConeTwistJointParam
constants).
staticfreeRid(rid:RID):Void
Destroys any of the objects created by PhysicsServer. If the godot.RID
passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console.
staticgeneric6dofJointGetFlag(joint:RID, axis:Vector3_Axis, flag:PhysicsServer_G6DOFJointAxisFlag):Bool
Gets a generic_6_DOF_joint flag (see godot.PhysicsServer_G6DOFJointAxisFlag
constants).
staticgeneric6dofJointGetParam(joint:RID, axis:Vector3_Axis, param:PhysicsServer_G6DOFJointAxisParam):Single
Gets a generic_6_DOF_joint parameter (see godot.PhysicsServer_G6DOFJointAxisParam
constants).
staticgeneric6dofJointSetFlag(joint:RID, axis:Vector3_Axis, flag:PhysicsServer_G6DOFJointAxisFlag, enable:Bool):Void
Sets a generic_6_DOF_joint flag (see godot.PhysicsServer_G6DOFJointAxisFlag
constants).
staticgeneric6dofJointSetParam(joint:RID, axis:Vector3_Axis, param:PhysicsServer_G6DOFJointAxisParam, value:Single):Void
Sets a generic_6_DOF_joint parameter (see godot.PhysicsServer_G6DOFJointAxisParam
constants).
staticgetProcessInfo(processInfo:PhysicsServer_ProcessInfo):Int
Returns information about the current state of the 3D physics engine. See godot.PhysicsServer_ProcessInfo
for a list of available states. Only implemented for Godot Physics.
statichingeJointGetFlag(joint:RID, flag:PhysicsServer_HingeJointFlag):Bool
Gets a hinge_joint flag (see godot.PhysicsServer_HingeJointFlag
constants).
statichingeJointGetParam(joint:RID, param:PhysicsServer_HingeJointParam):Single
Gets a hinge_joint parameter (see godot.PhysicsServer_HingeJointParam
).
statichingeJointSetFlag(joint:RID, flag:PhysicsServer_HingeJointFlag, enabled:Bool):Void
Sets a hinge_joint flag (see godot.PhysicsServer_HingeJointFlag
constants).
statichingeJointSetParam(joint:RID, param:PhysicsServer_HingeJointParam, value:Single):Void
Sets a hinge_joint parameter (see godot.PhysicsServer_HingeJointParam
constants).
staticjointCreateConeTwist(bodyA:RID, localRefA:Transform, bodyB:RID, localRefB:Transform):RID
Creates a godot.ConeTwistJoint
.
staticjointCreateGeneric6dof(bodyA:RID, localRefA:Transform, bodyB:RID, localRefB:Transform):RID
Creates a godot.Generic6DOFJoint
.
staticjointCreateHinge(bodyA:RID, hingeA:Transform, bodyB:RID, hingeB:Transform):RID
Creates a godot.HingeJoint
.
staticjointCreatePin(bodyA:RID, localA:Vector3, bodyB:RID, localB:Vector3):RID
Creates a godot.PinJoint
.
staticjointCreateSlider(bodyA:RID, localRefA:Transform, bodyB:RID, localRefB:Transform):RID
Creates a godot.SliderJoint
.
staticpinJointGetLocalA(joint:RID):Vector3
Returns position of the joint in the local space of body a of the joint.
staticpinJointGetLocalB(joint:RID):Vector3
Returns position of the joint in the local space of body b of the joint.
staticpinJointGetParam(joint:RID, param:PhysicsServer_PinJointParam):Single
Gets a pin_joint parameter (see godot.PhysicsServer_PinJointParam
constants).
staticpinJointSetLocalA(joint:RID, localA:Vector3):Void
Sets position of the joint in the local space of body a of the joint.
staticpinJointSetLocalB(joint:RID, localB:Vector3):Void
Sets position of the joint in the local space of body b of the joint.
staticpinJointSetParam(joint:RID, param:PhysicsServer_PinJointParam, value:Single):Void
Sets a pin_joint parameter (see godot.PhysicsServer_PinJointParam
constants).
staticsetCollisionIterations(iterations:Int):Void
Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. The default value is 8
.
Note: Only has an effect when using the GodotPhysics engine, not the default Bullet physics engine.
staticshapeCreate(type:PhysicsServer_ShapeType):RID
Creates a shape of a type from godot.PhysicsServer_ShapeType
. Does not assign it to a body or an area. To do so, you must use godot.PhysicsServer.areaSetShape
or godot.PhysicsServer.bodySetShape
.
staticshapeGetType(shape:RID):PhysicsServer_ShapeType
Returns the type of shape (see godot.PhysicsServer_ShapeType
constants).
staticshapeSetData(shape:RID, data:Dynamic):Void
Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created godot.PhysicsServer.shapeGetType
.
staticsliderJointGetParam(joint:RID, param:PhysicsServer_SliderJointParam):Single
Gets a slider_joint parameter (see godot.PhysicsServer_SliderJointParam
constants).
staticsliderJointSetParam(joint:RID, param:PhysicsServer_SliderJointParam, value:Single):Void
Gets a slider_joint parameter (see godot.PhysicsServer_SliderJointParam
constants).
staticspaceCreate():RID
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 godot.PhysicsServer.areaSetSpace
, or to a body with godot.PhysicsServer.bodySetSpace
.
staticspaceGetDirectState(space:RID):PhysicsDirectSpaceState
Returns the state of a space, a godot.PhysicsDirectSpaceState
. This object can be used to make collision/intersection queries.
staticspaceGetParam(space:RID, param:PhysicsServer_SpaceParameter):Single
Returns the value of a space parameter.
staticspaceSetActive(space:RID, active:Bool):Void
Marks a space as active. It will not have an effect, unless it is assigned to an area or body.
staticspaceSetParam(space:RID, param:PhysicsServer_SpaceParameter, value:Single):Void
Sets the value for a space parameter. A list of available parameters is on the godot.PhysicsServer_SpaceParameter
constants.