Physics2DServer Class |
Physics2DServer is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
Namespace: Godot
public static class Physics2DServer
The Physics2DServer type exposes the following members.
Name | Description | |
---|---|---|
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. | |
AreaAttachCanvasInstanceId | ||
AreaAttachObjectInstanceId | Assigns the area to a descendant of Object, 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 Area2D. After creating an Area2D with this method, assign it to a space using AreaSetSpace(RID, RID) to use the created Area2D in the physics world. | |
AreaGetCanvasInstanceId | ||
AreaGetObjectInstanceId | Gets the instance ID of the object the area is assigned to. | |
AreaGetParam | Returns an area parameter value. See Physics2DServerAreaParameter for a list of available parameters. | |
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. | |
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: or , 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. See Physics2DServerAreaParameter for a list of available parameters. | |
AreaSetShape | Substitutes a given area shape by another. The old shape is selected by its index, the new one by its RID. | |
AreaSetShapeDisabled | Disables a given shape in an area. | |
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. See Physics2DServerAreaSpaceOverrideMode for a list of available modes. | |
AreaSetTransform | Sets the transform matrix for an area. | |
BodyAddCentralForce | ||
BodyAddCollisionException | Adds a body to the list of bodies exempt from collisions. | |
BodyAddForce | Adds a positioned force to the applied force and torque. As with BodyApplyImpulse(RID, Vector2, Vector2), both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied. | |
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 | Adds a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. | |
BodyApplyTorqueImpulse | ||
BodyAttachCanvasInstanceId | ||
BodyAttachObjectInstanceId | Assigns the area to a descendant of Object, so it can exist in the node tree. | |
BodyClearShapes | Removes all shapes from a body. | |
BodyCreate | Creates a physics body. | |
BodyGetCanvasInstanceId | ||
BodyGetCollisionLayer | Returns the physics layer or layers a body belongs to. | |
BodyGetCollisionMask | Returns the physics layer or layers a body can collide with. | |
BodyGetContinuousCollisionDetectionMode | Returns the continuous collision detection mode. | |
BodyGetDirectState | Returns the Physics2DDirectBodyState of the body. | |
BodyGetMaxContactsReported | Returns the maximum contacts that can be reported. See BodySetMaxContactsReported(RID, Int32). | |
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. See Physics2DServerBodyParameter for a list of available parameters. | |
BodyGetShape | Returns the RID of the nth shape of a body. | |
BodyGetShapeCount | Returns the number of shapes assigned to a body. | |
BodyGetShapeMetadata | Returns the metadata of a shape of 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. | |
BodyIsOmittingForceIntegration | Returns whether a body uses a callback function to calculate its own physics (see BodySetForceIntegrationCallback(RID, Object, String, Object)). | |
BodyRemoveCollisionException | Removes a body from the list of bodies exempt from collisions. | |
BodyRemoveShape | Removes a shape from a body. The shape is not deleted, so it can be reused afterwards. | |
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. | |
BodySetContinuousCollisionDetectionMode | Sets the continuous collision detection mode using one of the Physics2DServerCCDMode constants. 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(RID, Boolean)). | |
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 using one of the Physics2DServerBodyMode constants. | |
BodySetOmitForceIntegration | Sets whether a body uses a callback function to calculate its own physics (see BodySetForceIntegrationCallback(RID, Object, String, Object)). | |
BodySetParam | Sets a body parameter. See Physics2DServerBodyParameter for a list of available parameters. | |
BodySetShape | Substitutes a given body shape by another. The old shape is selected by its index, the new one by its RID. | |
BodySetShapeAsOneWayCollision | Enables one way collision on body if enable is true. | |
BodySetShapeDisabled | Disables shape in body if disable is true. | |
BodySetShapeMetadata | Sets metadata of a shape within a body. This metadata is different from SetMeta(String, Object), and can be retrieved on shape queries. | |
BodySetShapeTransform | Sets the transform matrix for a body shape. | |
BodySetSpace | Assigns a space to the body (see SpaceCreate). | |
BodySetState | Sets a body state using one of the Physics2DServerBodyState constants. Note that the method doesn't take effect immediately. The state will change on the next physics frame. | |
BodyTestMotion | Returns true if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. Physics2DTestMotionResult can be passed to return additional information in. | |
CapsuleShapeCreate | ||
CircleShapeCreate | ||
ConcavePolygonShapeCreate | ||
ConvexPolygonShapeCreate | ||
DampedSpringJointCreate | Creates a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. | |
DampedStringJointGetParam | Returns the value of a damped spring joint parameter. | |
DampedStringJointSetParam | Sets a damped spring joint parameter. See Physics2DServerDampedStringParam for a list of available parameters. | |
FreeRid | Destroys any of the objects created by Physics2DServer. If the RID passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. | |
GetProcessInfo | Returns information about the current state of the 2D physics engine. See Physics2DServerProcessInfo for a list of available states. | |
GrooveJointCreate | Creates a groove joint between two bodies. If not specified, the bodies are assumed to be the joint itself. | |
JointGetParam | Returns the value of a joint parameter. | |
JointGetType | Returns a joint's type (see Physics2DServerJointType). | |
JointSetParam | Sets a joint parameter. See Physics2DServerJointParam for a list of available parameters. | |
LineShapeCreate | ||
PinJointCreate | Creates a pin joint between two bodies. If not specified, the second body is assumed to be the joint itself. | |
RayShapeCreate | ||
RectangleShapeCreate | ||
SegmentShapeCreate | ||
SetActive | Activates or deactivates the 2D physics engine. | |
ShapeGetData | Returns the shape data. | |
ShapeGetType | Returns a shape's type (see Physics2DServerShapeType). | |
ShapeSetData | Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created ShapeGetType(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(RID, RID), or to a body with BodySetSpace(RID, RID). | |
SpaceGetDirectState | Returns the state of a space, a Physics2DDirectSpaceState. 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. See Physics2DServerSpaceParameter for a list of available parameters. |