Documentation
¶
Overview ¶
Package PhysicsServer2D provides methods for working with PhysicsServer2D object instances.
Index ¶
- func Advanced() class
- func AreaAddShape(area RID.Area2D, shape RID.Shape2D)
- func AreaAttachCanvasInstanceId(area RID.Area2D, id int)
- func AreaAttachObjectInstanceId(area RID.Area2D, id int)
- func AreaClearShapes(area RID.Area2D)
- func AreaCreate() RID.Area2D
- func AreaGetCanvasInstanceId(area RID.Area2D) int
- func AreaGetCollisionLayer(area RID.Area2D) int
- func AreaGetCollisionMask(area RID.Area2D) int
- func AreaGetObjectInstanceId(area RID.Area2D) int
- func AreaGetParam(area RID.Area2D, param gdclass.PhysicsServer2DAreaParameter) any
- func AreaGetShape(area RID.Area2D, shape_idx int) RID.Shape2D
- func AreaGetShapeCount(area RID.Area2D) int
- func AreaGetShapeTransform(area RID.Area2D, shape_idx int) Transform2D.OriginXY
- func AreaGetSpace(area RID.Area2D) RID.Space2D
- func AreaGetTransform(area RID.Area2D) Transform2D.OriginXY
- func AreaRemoveShape(area RID.Area2D, shape_idx int)
- func AreaSetAreaMonitorCallback(area RID.Area2D, ...)
- func AreaSetCollisionLayer(area RID.Area2D, layer int)
- func AreaSetCollisionMask(area RID.Area2D, mask int)
- func AreaSetMonitorCallback(area RID.Area2D, ...)
- func AreaSetMonitorable(area RID.Area2D, monitorable bool)
- func AreaSetParam(area RID.Area2D, param gdclass.PhysicsServer2DAreaParameter, value any)
- func AreaSetShape(area RID.Area2D, shape_idx int, shape RID.Shape2D)
- func AreaSetShapeDisabled(area RID.Area2D, shape_idx int, disabled bool)
- func AreaSetShapeTransform(area RID.Area2D, shape_idx int, transform Transform2D.OriginXY)
- func AreaSetSpace(area RID.Area2D, space RID.Space2D)
- func AreaSetTransform(area RID.Area2D, transform Transform2D.OriginXY)
- func BodyAddCollisionException(body RID.Body2D, excepted_body RID.Body2D)
- func BodyAddConstantCentralForce(body RID.Body2D, force Vector2.XY)
- func BodyAddConstantForce(body RID.Body2D, force Vector2.XY)
- func BodyAddConstantTorque(body RID.Body2D, torque Float.X)
- func BodyAddShape(body RID.Body2D, shape RID.Shape2D)
- func BodyApplyCentralForce(body RID.Body2D, force Vector2.XY)
- func BodyApplyCentralImpulse(body RID.Body2D, impulse Vector2.XY)
- func BodyApplyForce(body RID.Body2D, force Vector2.XY)
- func BodyApplyImpulse(body RID.Body2D, impulse Vector2.XY)
- func BodyApplyTorque(body RID.Body2D, torque Float.X)
- func BodyApplyTorqueImpulse(body RID.Body2D, impulse Float.X)
- func BodyAttachCanvasInstanceId(body RID.Body2D, id int)
- func BodyAttachObjectInstanceId(body RID.Body2D, id int)
- func BodyClearShapes(body RID.Body2D)
- func BodyCreate() RID.Body2D
- func BodyGetCanvasInstanceId(body RID.Body2D) int
- func BodyGetCollisionLayer(body RID.Body2D) int
- func BodyGetCollisionMask(body RID.Body2D) int
- func BodyGetCollisionPriority(body RID.Body2D) Float.X
- func BodyGetConstantForce(body RID.Body2D) Vector2.XY
- func BodyGetConstantTorque(body RID.Body2D) Float.X
- func BodyGetContinuousCollisionDetectionMode(body RID.Body2D) gdclass.PhysicsServer2DCCDMode
- func BodyGetDirectState(body RID.Body2D) [1]gdclass.PhysicsDirectBodyState2D
- func BodyGetMaxContactsReported(body RID.Body2D) int
- func BodyGetMode(body RID.Body2D) gdclass.PhysicsServer2DBodyMode
- func BodyGetObjectInstanceId(body RID.Body2D) int
- func BodyGetParam(body RID.Body2D, param gdclass.PhysicsServer2DBodyParameter) any
- func BodyGetShape(body RID.Body2D, shape_idx int) RID.Shape2D
- func BodyGetShapeCount(body RID.Body2D) int
- func BodyGetShapeTransform(body RID.Body2D, shape_idx int) Transform2D.OriginXY
- func BodyGetSpace(body RID.Body2D) RID.Space2D
- func BodyGetState(body RID.Body2D, state gdclass.PhysicsServer2DBodyState) any
- func BodyIsOmittingForceIntegration(body RID.Body2D) bool
- func BodyRemoveCollisionException(body RID.Body2D, excepted_body RID.Body2D)
- func BodyRemoveShape(body RID.Body2D, shape_idx int)
- func BodyResetMassProperties(body RID.Body2D)
- func BodySetAxisVelocity(body RID.Body2D, axis_velocity Vector2.XY)
- func BodySetCollisionLayer(body RID.Body2D, layer int)
- func BodySetCollisionMask(body RID.Body2D, mask int)
- func BodySetCollisionPriority(body RID.Body2D, priority Float.X)
- func BodySetConstantForce(body RID.Body2D, force Vector2.XY)
- func BodySetConstantTorque(body RID.Body2D, torque Float.X)
- func BodySetContinuousCollisionDetectionMode(body RID.Body2D, mode gdclass.PhysicsServer2DCCDMode)
- func BodySetForceIntegrationCallback(body RID.Body2D, ...)
- func BodySetMaxContactsReported(body RID.Body2D, amount int)
- func BodySetMode(body RID.Body2D, mode gdclass.PhysicsServer2DBodyMode)
- func BodySetOmitForceIntegration(body RID.Body2D, enable bool)
- func BodySetParam(body RID.Body2D, param gdclass.PhysicsServer2DBodyParameter, value any)
- func BodySetShape(body RID.Body2D, shape_idx int, shape RID.Shape2D)
- func BodySetShapeAsOneWayCollision(body RID.Body2D, shape_idx int, enable bool, margin Float.X)
- func BodySetShapeDisabled(body RID.Body2D, shape_idx int, disabled bool)
- func BodySetShapeTransform(body RID.Body2D, shape_idx int, transform Transform2D.OriginXY)
- func BodySetSpace(body RID.Body2D, space RID.Space2D)
- func BodySetState(body RID.Body2D, state gdclass.PhysicsServer2DBodyState, value any)
- func BodySetStateSyncCallback(body RID.Body2D, callable func(state [1]gdclass.PhysicsDirectBodyState2D))
- func BodyTestMotion(body RID.Body2D, parameters [1]gdclass.PhysicsTestMotionParameters2D) bool
- func CapsuleShapeCreate() RID.Shape2D
- func CircleShapeCreate() RID.Shape2D
- func ConcavePolygonShapeCreate() RID.Shape2D
- func ConvexPolygonShapeCreate() RID.Shape2D
- func DampedSpringJointGetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DDampedSpringParam) Float.X
- func DampedSpringJointSetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DDampedSpringParam, ...)
- func FreeRid(rid RID.Any)
- func GetProcessInfo(process_info gdclass.PhysicsServer2DProcessInfo) int
- func JointClear(joint RID.Joint2D)
- func JointCreate() RID.Joint2D
- func JointDisableCollisionsBetweenBodies(joint RID.Joint2D, disable bool)
- func JointGetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DJointParam) Float.X
- func JointGetType(joint RID.Joint2D) gdclass.PhysicsServer2DJointType
- func JointIsDisabledCollisionsBetweenBodies(joint RID.Joint2D) bool
- func JointMakeDampedSpring(joint RID.Joint2D, anchor_a Vector2.XY, anchor_b Vector2.XY, body_a RID.Body2D)
- func JointMakeGroove(joint RID.Joint2D, groove1_a Vector2.XY, groove2_a Vector2.XY, ...)
- func JointMakePin(joint RID.Joint2D, anchor Vector2.XY, body_a RID.Body2D)
- func JointSetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DJointParam, value Float.X)
- func PinJointGetFlag(joint RID.Joint2D, flag gdclass.PhysicsServer2DPinJointFlag) bool
- func PinJointGetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DPinJointParam) Float.X
- func PinJointSetFlag(joint RID.Joint2D, flag gdclass.PhysicsServer2DPinJointFlag, enabled bool)
- func PinJointSetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DPinJointParam, value Float.X)
- func RectangleShapeCreate() RID.Shape2D
- func SegmentShapeCreate() RID.Shape2D
- func SeparationRayShapeCreate() RID.Shape2D
- func SetActive(active bool)
- func ShapeGetData(shape RID.Shape2D) any
- func ShapeGetType(shape RID.Shape2D) gdclass.PhysicsServer2DShapeType
- func ShapeSetData(shape RID.Shape2D, data any)
- func SpaceCreate() RID.Space2D
- func SpaceGetDirectState(space RID.Space2D) [1]gdclass.PhysicsDirectSpaceState2D
- func SpaceGetParam(space RID.Space2D, param gdclass.PhysicsServer2DSpaceParameter) Float.X
- func SpaceIsActive(space RID.Space2D) bool
- func SpaceSetActive(space RID.Space2D, active bool)
- func SpaceSetParam(space RID.Space2D, param gdclass.PhysicsServer2DSpaceParameter, value Float.X)
- func WorldBoundaryShapeCreate() RID.Shape2D
- type AreaBodyStatus
- type AreaParameter
- type AreaSpaceOverrideMode
- type BodyDampMode
- type BodyMode
- type BodyParameter
- type BodyState
- type CCDMode
- type DampedSpringParam
- type JointParam
- type JointType
- type PinJointFlag
- type PinJointParam
- type ProcessInfo
- type ShapeType
- type SpaceParameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func AreaAddShape ¶
Adds a shape to the area, with the given local transform. The shape (together with its [param transform] and [param disabled] properties) is added to an array of shapes, and the shapes of an area are usually referenced by their index in this array.
func AreaAttachCanvasInstanceId ¶
Attaches the [code]ObjectID[/code] of a canvas to the area. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CanvasLayer].
func AreaAttachObjectInstanceId ¶
Attaches the [code]ObjectID[/code] of an [Object] to the area. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CollisionObject2D].
func AreaClearShapes ¶
Removes all shapes from the area. This does not delete the shapes themselves, so they can continue to be used elsewhere or added back later.
func AreaCreate ¶
Creates a 2D area object in the physics server, and returns the [RID] that identifies it. The default settings for the created area include a collision layer and mask set to [code]1[/code], and [code]monitorable[/code] set to [code]false[/code]. Use [method area_add_shape] to add shapes to it, use [method area_set_transform] to set its transform, and use [method area_set_space] to add the area to a space. If you want the area to be detectable use [method area_set_monitorable].
func AreaGetCanvasInstanceId ¶
Returns the [code]ObjectID[/code] of the canvas attached to the area. Use [method @GlobalScope.instance_from_id] to retrieve a [CanvasLayer] from a nonzero [code]ObjectID[/code].
func AreaGetCollisionLayer ¶
Returns the physics layer or layers the area belongs to, as a bitmask.
func AreaGetCollisionMask ¶
Returns the physics layer or layers the area can contact with, as a bitmask.
func AreaGetObjectInstanceId ¶
Returns the [code]ObjectID[/code] attached to the area. Use [method @GlobalScope.instance_from_id] to retrieve an [Object] from a nonzero [code]ObjectID[/code].
func AreaGetParam ¶
func AreaGetParam(area RID.Area2D, param gdclass.PhysicsServer2DAreaParameter) any
Returns the value of the given area parameter. See [enum AreaParameter] for the list of available parameters.
func AreaGetShape ¶
Returns the [RID] of the shape with the given index in the area's array of shapes.
func AreaGetShapeCount ¶
Returns the number of shapes added to the area.
func AreaGetShapeTransform ¶
func AreaGetShapeTransform(area RID.Area2D, shape_idx int) Transform2D.OriginXY
Returns the local transform matrix of the shape with the given index in the area's array of shapes.
func AreaGetSpace ¶
Returns the [RID] of the space assigned to the area. Returns an empty [RID] if no space is assigned.
func AreaGetTransform ¶
func AreaGetTransform(area RID.Area2D) Transform2D.OriginXY
Returns the transform matrix of the area.
func AreaRemoveShape ¶
Removes the shape with the given index from the area's array of shapes. The shape itself is not deleted, so it can continue to be used elsewhere or added back later. As a result of this operation, the area's shapes which used to have indices higher than [param shape_idx] will have their index decreased by one.
func AreaSetAreaMonitorCallback ¶
func AreaSetAreaMonitorCallback(area RID.Area2D, callback func(status int, body_rid RID.Any, instance_id Object.ID, body_shape_idx int, self_shape_idx int))
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 [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other area's shape entered or exited the area, 2. an [RID] [code]area_rid[/code]: the [RID] of the other area that entered or exited the area, 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the other area, 4. an integer [code]area_shape_idx[/code]: the index of the shape of the other area that entered or exited the area, 5. an integer [code]self_shape_idx[/code]: 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.
func AreaSetCollisionLayer ¶
Assigns the area to one or many physics layers, via a bitmask.
func AreaSetCollisionMask ¶
Sets which physics layers the area will monitor, via a bitmask.
func AreaSetMonitorCallback ¶
func AreaSetMonitorCallback(area RID.Area2D, callback func(status int, body_rid RID.Any, instance_id Object.ID, body_shape_idx int, self_shape_idx int))
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 [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other body shape entered or exited the area, 2. an [RID] [code]body_rid[/code]: the [RID] of the body that entered or exited the area, 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the body, 4. an integer [code]body_shape_idx[/code]: the index of the shape of the body that entered or exited the area, 5. an integer [code]self_shape_idx[/code]: 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.
func AreaSetMonitorable ¶
Sets whether the area is monitorable or not. If [param monitorable] is [code]true[/code], the area monitoring callback of other areas will be called when this area enters or exits them.
func AreaSetParam ¶
func AreaSetParam(area RID.Area2D, param gdclass.PhysicsServer2DAreaParameter, value any)
Sets the value of the given area parameter. See [enum AreaParameter] for the list of available parameters.
func AreaSetShape ¶
Replaces the area's shape at the given index by another shape, while not affecting the [code]transform[/code] and [code]disabled[/code] properties at the same index.
func AreaSetShapeDisabled ¶
Sets the disabled property of the area's shape with the given index. If [param disabled] is [code]true[/code], then the shape will not detect any other shapes entering or exiting it.
func AreaSetShapeTransform ¶
func AreaSetShapeTransform(area RID.Area2D, shape_idx int, transform Transform2D.OriginXY)
Sets the local transform matrix of the area's shape with the given index.
func AreaSetSpace ¶
Adds the area to the given space, after removing the area from the previously assigned space (if any). [b]Note:[/b] To remove an area from a space without immediately adding it back elsewhere, use [code]PhysicsServer2D.area_set_space(area, RID())[/code].
func AreaSetTransform ¶
func AreaSetTransform(area RID.Area2D, transform Transform2D.OriginXY)
Sets the transform matrix of the area.
func BodyAddCollisionException ¶
Adds [param excepted_body] to the body's list of collision exceptions, so that collisions with it are ignored.
func BodyAddConstantCentralForce ¶
Adds a constant directional force to the body. The force does not affect rotation. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_force(body, Vector2(0, 0))[/code]. This is equivalent to using [method body_add_constant_force] at the body's center of mass.
func BodyAddConstantForce ¶
Adds a constant positioned force to the body. The force can affect rotation if [param position] is different from the body's center of mass. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_force(body, Vector2(0, 0))[/code]. [param position] is the offset from the body origin in global coordinates.
func BodyAddConstantTorque ¶
Adds a constant rotational force to the body. The force does not affect position. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_torque(body, 0)[/code].
func BodyAddShape ¶
Adds a shape to the area, with the given local transform. The shape (together with its [param transform] and [param disabled] properties) is added to an array of shapes, and the shapes of a body are usually referenced by their index in this array.
func BodyApplyCentralForce ¶
Applies a directional force to the body, at the body's center of mass. The force does not affect rotation. A force is time dependent and meant to be applied every physics update. This is equivalent to using [method body_apply_force] at the body's center of mass.
func BodyApplyCentralImpulse ¶
Applies a directional impulse to the body, at the body's center of mass. The impulse does not affect 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 [method body_apply_impulse] at the body's center of mass.
func BodyApplyForce ¶
Applies a positioned force to the body. The force can affect rotation if [param position] is different from the body's center of mass. A force is time dependent and meant to be applied every physics update. [param position] is the offset from the body origin in global coordinates.
func BodyApplyImpulse ¶
Applies a positioned impulse to the body. The impulse can affect rotation if [param position] is different from the body's center of mass. 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). [param position] is the offset from the body origin in global coordinates.
func BodyApplyTorque ¶
Applies a rotational force to the body. The force does not affect position. A force is time dependent and meant to be applied every physics update.
func BodyApplyTorqueImpulse ¶
Applies a rotational impulse to the body. The impulse does not affect 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).
func BodyAttachCanvasInstanceId ¶
Attaches the [code]ObjectID[/code] of a canvas to the body. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CanvasLayer].
func BodyAttachObjectInstanceId ¶
Attaches the [code]ObjectID[/code] of an [Object] to the body. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CollisionObject2D].
func BodyClearShapes ¶
Removes all shapes from the body. This does not delete the shapes themselves, so they can continue to be used elsewhere or added back later.
func BodyCreate ¶
Creates a 2D body object in the physics server, and returns the [RID] that identifies it. The default settings for the created area include a collision layer and mask set to [code]1[/code], and body mode set to [constant BODY_MODE_RIGID]. Use [method body_add_shape] to add shapes to it, use [method body_set_state] to set its transform, and use [method body_set_space] to add the body to a space.
func BodyGetCanvasInstanceId ¶
Returns the [code]ObjectID[/code] of the canvas attached to the body. Use [method @GlobalScope.instance_from_id] to retrieve a [CanvasLayer] from a nonzero [code]ObjectID[/code].
func BodyGetCollisionLayer ¶
Returns the physics layer or layers the body belongs to, as a bitmask.
func BodyGetCollisionMask ¶
Returns the physics layer or layers the body can collide with, as a bitmask.
func BodyGetCollisionPriority ¶
Returns the body's collision priority. This is used in the depenetration phase of [method body_test_motion]. The higher the priority is, the lower the penetration into the body will be.
func BodyGetConstantForce ¶
Returns the body's total constant positional force applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force].
func BodyGetConstantTorque ¶
Returns the body's total constant rotational force applied during each physics update. See [method body_add_constant_torque].
func BodyGetContinuousCollisionDetectionMode ¶
func BodyGetContinuousCollisionDetectionMode(body RID.Body2D) gdclass.PhysicsServer2DCCDMode
Returns the body's continuous collision detection mode (see [enum CCDMode]).
func BodyGetDirectState ¶
func BodyGetDirectState(body RID.Body2D) [1]gdclass.PhysicsDirectBodyState2D
Returns the [PhysicsDirectBodyState2D] of the body. Returns [code]null[/code] if the body is destroyed or not assigned to a space.
func BodyGetMaxContactsReported ¶
Returns the maximum number of contacts that the body can report. See [method body_set_max_contacts_reported].
func BodyGetMode ¶
func BodyGetMode(body RID.Body2D) gdclass.PhysicsServer2DBodyMode
Returns the body's mode (see [enum BodyMode]).
func BodyGetObjectInstanceId ¶
Returns the [code]ObjectID[/code] attached to the body. Use [method @GlobalScope.instance_from_id] to retrieve an [Object] from a nonzero [code]ObjectID[/code].
func BodyGetParam ¶
func BodyGetParam(body RID.Body2D, param gdclass.PhysicsServer2DBodyParameter) any
Returns the value of the given body parameter. See [enum BodyParameter] for the list of available parameters.
func BodyGetShape ¶
Returns the [RID] of the shape with the given index in the body's array of shapes.
func BodyGetShapeCount ¶
Returns the number of shapes added to the body.
func BodyGetShapeTransform ¶
func BodyGetShapeTransform(body RID.Body2D, shape_idx int) Transform2D.OriginXY
Returns the local transform matrix of the shape with the given index in the area's array of shapes.
func BodyGetSpace ¶
Returns the [RID] of the space assigned to the body. Returns an empty [RID] if no space is assigned.
func BodyGetState ¶
func BodyGetState(body RID.Body2D, state gdclass.PhysicsServer2DBodyState) any
Returns the value of the given state of the body. See [enum BodyState] for the list of available states.
func BodyIsOmittingForceIntegration ¶
Returns [code]true[/code] if the body is omitting the standard force integration. See [method body_set_omit_force_integration].
func BodyRemoveCollisionException ¶
Removes [param excepted_body] from the body's list of collision exceptions, so that collisions with it are no longer ignored.
func BodyRemoveShape ¶
Removes the shape with the given index from the body's array of shapes. The shape itself is not deleted, so it can continue to be used elsewhere or added back later. As a result of this operation, the body's shapes which used to have indices higher than [param shape_idx] will have their index decreased by one.
func BodyResetMassProperties ¶
Restores the default inertia and center of mass of the body based on its shapes. This undoes any custom values previously set using [method body_set_param].
func BodySetAxisVelocity ¶
Modifies the body's linear velocity so that its projection to the axis [code]axis_velocity.normalized()[/code] is exactly [code]axis_velocity.length()[/code]. This is useful for jumping behavior.
func BodySetCollisionLayer ¶
Sets the physics layer or layers the body belongs to, via a bitmask.
func BodySetCollisionMask ¶
Sets the physics layer or layers the body can collide with, via a bitmask.
func BodySetCollisionPriority ¶
Sets the body's collision priority. This is used in the depenetration phase of [method body_test_motion]. The higher the priority is, the lower the penetration into the body will be.
func BodySetConstantForce ¶
Sets the body's total constant positional force applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force].
func BodySetConstantTorque ¶
Sets the body's total constant rotational force applied during each physics update. See [method body_add_constant_torque].
func BodySetContinuousCollisionDetectionMode ¶
func BodySetContinuousCollisionDetectionMode(body RID.Body2D, mode gdclass.PhysicsServer2DCCDMode)
Sets the continuous collision detection mode using one of the [enum CCDMode] constants. Continuous collision detection tries to predict where a moving body would collide in between physics updates, instead of moving it and correcting its movement if it collided.
func BodySetForceIntegrationCallback ¶
func BodySetForceIntegrationCallback(body RID.Body2D, callable func(state [1]gdclass.PhysicsDirectBodyState2D, userdata any))
Sets the body's custom force integration callback function to [param callable]. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback. The function [param callable] will be called every physics tick, before the standard force integration (see [method body_set_omit_force_integration]). It can be used for example to update the body's linear and angular velocity based on contact with other bodies. If [param userdata] is not [code]null[/code], the function [param callable] must take the following two parameters: 1. [code]state[/code]: a [PhysicsDirectBodyState2D] used to retrieve and modify the body's state, 2. [code skip-lint]userdata[/code]: a [Variant]; its value will be the [param userdata] passed into this method. If [param userdata] is [code]null[/code], then [param callable] must take only the [code]state[/code] parameter.
func BodySetMaxContactsReported ¶
Sets the maximum number of contacts that the body can report. If [param amount] is greater than zero, then the body will keep track of at most this many contacts with other bodies.
func BodySetMode ¶
func BodySetMode(body RID.Body2D, mode gdclass.PhysicsServer2DBodyMode)
Sets the body's mode. See [enum BodyMode] for the list of available modes.
func BodySetOmitForceIntegration ¶
Sets whether the body omits the standard force integration. If [param enable] is [code]true[/code], the body will not automatically use applied forces, torques, and damping to update the body's linear and angular velocity. In this case, [method body_set_force_integration_callback] can be used to manually update the linear and angular velocity instead. This method is called when the property [member RigidBody2D.custom_integrator] is set.
func BodySetParam ¶
func BodySetParam(body RID.Body2D, param gdclass.PhysicsServer2DBodyParameter, value any)
Sets the value of the given body parameter. See [enum BodyParameter] for the list of available parameters.
func BodySetShape ¶
Replaces the body's shape at the given index by another shape, while not affecting the [code]transform[/code], [code]disabled[/code], and one-way collision properties at the same index.
func BodySetShapeAsOneWayCollision ¶
Sets the one-way collision properties of the body's shape with the given index. If [param enable] is [code]true[/code], the one-way collision direction given by the shape's local upward axis [code]body_get_shape_transform(body, shape_idx).y[/code] will be used to ignore collisions with the shape in the opposite direction, and to ensure depenetration of kinematic bodies happens in this direction.
func BodySetShapeDisabled ¶
Sets the disabled property of the body's shape with the given index. If [param disabled] is [code]true[/code], then the shape will be ignored in all collision detection.
func BodySetShapeTransform ¶
func BodySetShapeTransform(body RID.Body2D, shape_idx int, transform Transform2D.OriginXY)
Sets the local transform matrix of the body's shape with the given index.
func BodySetSpace ¶
Adds the body to the given space, after removing the body from the previously assigned space (if any). If the body's mode is set to [constant BODY_MODE_RIGID], then adding the body to a space will have the following additional effects: - If the parameter [constant BODY_PARAM_CENTER_OF_MASS] has never been set explicitly, then the value of that parameter will be recalculated based on the body's shapes. - If the parameter [constant BODY_PARAM_INERTIA] is set to a value [code]<= 0.0[/code], then the value of that parameter will be recalculated based on the body's shapes, mass, and center of mass. [b]Note:[/b] To remove a body from a space without immediately adding it back elsewhere, use [code]PhysicsServer2D.body_set_space(body, RID())[/code].
func BodySetState ¶
func BodySetState(body RID.Body2D, state gdclass.PhysicsServer2DBodyState, value any)
Sets the value of a body's state. See [enum BodyState] for the list of available states. [b]Note:[/b] The state change doesn't take effect immediately. The state will change on the next physics frame.
func BodySetStateSyncCallback ¶
func BodySetStateSyncCallback(body RID.Body2D, callable func(state [1]gdclass.PhysicsDirectBodyState2D))
Sets the body's state synchronization callback function to [param callable]. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the callback. The function [param callable] will be called every physics frame, assuming that the body was active during the previous physics tick, and can be used to fetch the latest state from the physics server. The function [param callable] must take the following parameters: 1. [code]state[/code]: a [PhysicsDirectBodyState2D], used to retrieve the body's state.
func BodyTestMotion ¶
func BodyTestMotion(body RID.Body2D, parameters [1]gdclass.PhysicsTestMotionParameters2D) bool
Returns [code]true[/code] if a collision would result from moving the body along a motion vector from a given point in space. See [PhysicsTestMotionParameters2D] for the available motion parameters. Optionally a [PhysicsTestMotionResult2D] object can be passed, which will be used to store the information about the resulting collision.
func CapsuleShapeCreate ¶
Creates a 2D capsule shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the capsule's height and radius.
func CircleShapeCreate ¶
Creates a 2D circle shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the circle's radius.
func ConcavePolygonShapeCreate ¶
Creates a 2D concave polygon shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the concave polygon's segments.
func ConvexPolygonShapeCreate ¶
Creates a 2D convex polygon shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the convex polygon's points.
func DampedSpringJointGetParam ¶
func DampedSpringJointGetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DDampedSpringParam) Float.X
Returns the value of the given damped spring joint parameter. See [enum DampedSpringParam] for the list of available parameters.
func DampedSpringJointSetParam ¶
func DampedSpringJointSetParam(joint RID.Joint2D, param gdclass.PhysicsServer2DDampedSpringParam, value Float.X)
Sets the value of the given damped spring joint parameter. See [enum DampedSpringParam] for the list of available parameters.
func FreeRid ¶
Destroys any of the objects created by PhysicsServer2D. If the [RID] passed is not one of the objects that can be created by PhysicsServer2D, an error will be printed to the console.
func GetProcessInfo ¶
func GetProcessInfo(process_info gdclass.PhysicsServer2DProcessInfo) int
Returns information about the current state of the 2D physics engine. See [enum ProcessInfo] for the list of available states.
func JointClear ¶
Destroys the joint with the given [RID], creates a new uninitialized joint, and makes the [RID] refer to this new joint.
func JointCreate ¶
Creates a 2D joint in the physics server, and returns the [RID] that identifies it. To set the joint type, use [method joint_make_damped_spring], [method joint_make_groove] or [method joint_make_pin]. Use [method joint_set_param] to set generic joint parameters.
func JointDisableCollisionsBetweenBodies ¶
Sets whether the bodies attached to the [Joint2D] will collide with each other.
func JointGetParam ¶
Returns the value of the given joint parameter. See [enum JointParam] for the list of available parameters.
func JointGetType ¶
func JointGetType(joint RID.Joint2D) gdclass.PhysicsServer2DJointType
Returns the joint's type (see [enum JointType]).
func JointIsDisabledCollisionsBetweenBodies ¶
Returns whether the bodies attached to the [Joint2D] will collide with each other.
func JointMakeDampedSpring ¶
func JointMakeDampedSpring(joint RID.Joint2D, anchor_a Vector2.XY, anchor_b Vector2.XY, body_a RID.Body2D)
Makes the joint a damped spring joint, attached at the point [param anchor_a] (given in global coordinates) on the body [param body_a] and at the point [param anchor_b] (given in global coordinates) on the body [param body_b]. To set the parameters which are specific to the damped spring, see [method damped_spring_joint_set_param].
func JointMakeGroove ¶
func JointMakeGroove(joint RID.Joint2D, groove1_a Vector2.XY, groove2_a Vector2.XY, anchor_b Vector2.XY)
Makes the joint a groove joint.
func JointMakePin ¶
Makes the joint a pin joint. If [param body_b] is an empty [RID], then [param body_a] is pinned to the point [param anchor] (given in global coordinates); otherwise, [param body_a] is pinned to [param body_b] at the point [param anchor] (given in global coordinates). To set the parameters which are specific to the pin joint, see [method pin_joint_set_param].
func JointSetParam ¶
Sets the value of the given joint parameter. See [enum JointParam] for the list of available parameters.
func PinJointGetFlag ¶
func PinJointGetFlag(joint RID.Joint2D, flag gdclass.PhysicsServer2DPinJointFlag) bool
Gets a pin joint flag (see [enum PinJointFlag] constants).
func PinJointGetParam ¶
Returns the value of a pin joint parameter. See [enum PinJointParam] for a list of available parameters.
func PinJointSetFlag ¶
func PinJointSetFlag(joint RID.Joint2D, flag gdclass.PhysicsServer2DPinJointFlag, enabled bool)
Sets a pin joint flag (see [enum PinJointFlag] constants).
func PinJointSetParam ¶
Sets a pin joint parameter. See [enum PinJointParam] for a list of available parameters.
func RectangleShapeCreate ¶
Creates a 2D rectangle shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the rectangle's half-extents.
func SegmentShapeCreate ¶
Creates a 2D segment shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the segment's start and end points.
func SeparationRayShapeCreate ¶
Creates a 2D separation ray shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the shape's [code]length[/code] and [code]slide_on_slope[/code] properties.
func SetActive ¶
func SetActive(active bool)
Activates or deactivates the 2D physics server. If [param active] is [code]false[/code], then the physics server will not do anything in its physics step.
func ShapeGetData ¶
Returns the shape data that defines the configuration of the shape, such as the half-extents of a rectangle or the segments of a concave shape. See [method shape_set_data] for the precise format of this data in each case.
func ShapeGetType ¶
func ShapeGetType(shape RID.Shape2D) gdclass.PhysicsServer2DShapeType
Returns the shape's type (see [enum ShapeType]).
func ShapeSetData ¶
Sets the shape data that defines the configuration of the shape. The [param data] to be passed depends on the shape's type (see [method shape_get_type]): - [constant SHAPE_WORLD_BOUNDARY]: an array of length two containing a [Vector2] [code]normal[/code] direction and a [float] distance [code]d[/code], - [constant SHAPE_SEPARATION_RAY]: a dictionary containing the key [code]length[/code] with a [float] value and the key [code]slide_on_slope[/code] with a [bool] value, - [constant SHAPE_SEGMENT]: a [Rect2] [code]rect[/code] containing the first point of the segment in [code]rect.position[/code] and the second point of the segment in [code]rect.size[/code], - [constant SHAPE_CIRCLE]: a [float] [code]radius[/code], - [constant SHAPE_RECTANGLE]: a [Vector2] [code]half_extents[/code], - [constant SHAPE_CAPSULE]: an array of length two (or a [Vector2]) containing a [float] [code]height[/code] and a [float] [code]radius[/code], - [constant SHAPE_CONVEX_POLYGON]: either a [PackedVector2Array] of points defining a convex polygon in counterclockwise order (the clockwise outward normal of each segment formed by consecutive points is calculated internally), or a [PackedFloat32Array] of length divisible by four so that every 4-tuple of [float]s contains the coordinates of a point followed by the coordinates of the clockwise outward normal vector to the segment between the current point and the next point, - [constant SHAPE_CONCAVE_POLYGON]: a [PackedVector2Array] of length divisible by two (each pair of points forms one segment). [b]Warning:[/b] In the case of [constant SHAPE_CONVEX_POLYGON], this method does not check if the points supplied actually form a convex polygon (unlike the [member CollisionPolygon2D.polygon] property).
func SpaceCreate ¶
Creates a 2D space in the physics server, and returns the [RID] that identifies it. A space contains bodies and areas, and controls the stepping of the physics simulation of the objects in it.
func SpaceGetDirectState ¶
func SpaceGetDirectState(space RID.Space2D) [1]gdclass.PhysicsDirectSpaceState2D
Returns the state of a space, a [PhysicsDirectSpaceState2D]. This object can be used for collision/intersection queries.
func SpaceGetParam ¶
Returns the value of the given space parameter. See [enum SpaceParameter] for the list of available parameters.
func SpaceIsActive ¶
Returns [code]true[/code] if the space is active.
func SpaceSetActive ¶
Activates or deactivates the space. If [param active] is [code]false[/code], then the physics server will not do anything with this space in its physics step.
func SpaceSetParam ¶
Sets the value of the given space parameter. See [enum SpaceParameter] for the list of available parameters.
func WorldBoundaryShapeCreate ¶
Creates a 2D world boundary shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the shape's normal direction and distance properties.
Types ¶
type AreaBodyStatus ¶
type AreaBodyStatus = gdclass.PhysicsServer2DAreaBodyStatus //gd:PhysicsServer2D.AreaBodyStatus
const ( /*The value of the first parameter and area callback function receives, when an object enters one of its shapes.*/ AreaBodyAdded AreaBodyStatus = 0 /*The value of the first parameter and area callback function receives, when an object exits one of its shapes.*/ AreaBodyRemoved AreaBodyStatus = 1 )
type AreaParameter ¶
type AreaParameter = gdclass.PhysicsServer2DAreaParameter //gd:PhysicsServer2D.AreaParameter
const ( /*Constant to set/get gravity override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED].*/ AreaParamGravityOverrideMode AreaParameter = 0 /*Constant to set/get gravity strength in an area. The default value of this parameter is [code]9.80665[/code].*/ AreaParamGravity AreaParameter = 1 /*Constant to set/get gravity vector/center in an area. The default value of this parameter is [code]Vector2(0, -1)[/code].*/ AreaParamGravityVector AreaParameter = 2 /*Constant to set/get whether the gravity vector of an area is a direction, or a center point. The default value of this parameter is [code]false[/code].*/ AreaParamGravityIsPoint AreaParameter = 3 /*Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. The above is true only when the unit distance is a positive number. When the unit distance is set to 0.0, the gravity will be constant regardless of distance. The default value of this parameter is [code]0.0[/code].*/ AreaParamGravityPointUnitDistance AreaParameter = 4 /*Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED].*/ AreaParamLinearDampOverrideMode AreaParameter = 5 /*Constant to set/get the linear damping factor of an area. The default value of this parameter is [code]0.1[/code].*/ AreaParamLinearDamp AreaParameter = 6 /*Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED].*/ AreaParamAngularDampOverrideMode AreaParameter = 7 /*Constant to set/get the angular damping factor of an area. The default value of this parameter is [code]1.0[/code].*/ AreaParamAngularDamp AreaParameter = 8 /*Constant to set/get the priority (order of processing) of an area. The default value of this parameter is [code]0[/code].*/ AreaParamPriority AreaParameter = 9 )
type AreaSpaceOverrideMode ¶
type AreaSpaceOverrideMode = gdclass.PhysicsServer2DAreaSpaceOverrideMode //gd:PhysicsServer2D.AreaSpaceOverrideMode
const ( /*This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them.*/ AreaSpaceOverrideDisabled AreaSpaceOverrideMode = 0 /*This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.*/ AreaSpaceOverrideCombine AreaSpaceOverrideMode = 1 /*This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.*/ AreaSpaceOverrideCombineReplace AreaSpaceOverrideMode = 2 /*This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.*/ AreaSpaceOverrideReplace AreaSpaceOverrideMode = 3 /*This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.*/ AreaSpaceOverrideReplaceCombine AreaSpaceOverrideMode = 4 )
type BodyDampMode ¶
type BodyDampMode = gdclass.PhysicsServer2DBodyDampMode //gd:PhysicsServer2D.BodyDampMode
const ( /*The body's damping value is added to any value set in areas or the default value.*/ BodyDampModeCombine BodyDampMode = 0 /*The body's damping value replaces any value set in areas or the default value.*/ BodyDampModeReplace BodyDampMode = 1 )
type BodyMode ¶
type BodyMode = gdclass.PhysicsServer2DBodyMode //gd:PhysicsServer2D.BodyMode
const ( /*Constant for static bodies. In this mode, a body can be only moved by user code and doesn't collide with other bodies along its path when moved.*/ BodyModeStatic BodyMode = 0 /*Constant for kinematic bodies. In this mode, a body can be only moved by user code and collides with other bodies along its path.*/ BodyModeKinematic BodyMode = 1 /*Constant for rigid bodies. In this mode, a body can be pushed by other bodies and has forces applied.*/ BodyModeRigid BodyMode = 2 /*Constant for linear rigid bodies. In this mode, a body can not rotate, and only its linear velocity is affected by external forces.*/ BodyModeRigidLinear BodyMode = 3 )
type BodyParameter ¶
type BodyParameter = gdclass.PhysicsServer2DBodyParameter //gd:PhysicsServer2D.BodyParameter
const ( /*Constant to set/get a body's bounce factor. The default value of this parameter is [code]0.0[/code].*/ BodyParamBounce BodyParameter = 0 /*Constant to set/get a body's friction. The default value of this parameter is [code]1.0[/code].*/ BodyParamFriction BodyParameter = 1 /*Constant to set/get a body's mass. The default value of this parameter is [code]1.0[/code]. If the body's mode is set to [constant BODY_MODE_RIGID], then setting this parameter will have the following additional effects: - If the parameter [constant BODY_PARAM_CENTER_OF_MASS] has never been set explicitly, then the value of that parameter will be recalculated based on the body's shapes. - If the parameter [constant BODY_PARAM_INERTIA] is set to a value [code]<= 0.0[/code], then the value of that parameter will be recalculated based on the body's shapes, mass, and center of mass.*/ BodyParamMass BodyParameter = 2 /*Constant to set/get a body's inertia. The default value of this parameter is [code]0.0[/code]. If the body's inertia is set to a value [code]<= 0.0[/code], then the inertia will be recalculated based on the body's shapes, mass, and center of mass.*/ BodyParamInertia BodyParameter = 3 /*Constant to set/get a body's center of mass position in the body's local coordinate system. The default value of this parameter is [code]Vector2(0,0)[/code]. If this parameter is never set explicitly, then it is recalculated based on the body's shapes when setting the parameter [constant BODY_PARAM_MASS] or when calling [method body_set_space].*/ BodyParamCenterOfMass BodyParameter = 4 /*Constant to set/get a body's gravity multiplier. The default value of this parameter is [code]1.0[/code].*/ BodyParamGravityScale BodyParameter = 5 /*Constant to set/get a body's linear damping mode. See [enum BodyDampMode] for possible values. The default value of this parameter is [constant BODY_DAMP_MODE_COMBINE].*/ BodyParamLinearDampMode BodyParameter = 6 /*Constant to set/get a body's angular damping mode. See [enum BodyDampMode] for possible values. The default value of this parameter is [constant BODY_DAMP_MODE_COMBINE].*/ BodyParamAngularDampMode BodyParameter = 7 /*Constant to set/get a body's linear damping factor. The default value of this parameter is [code]0.0[/code].*/ BodyParamLinearDamp BodyParameter = 8 /*Constant to set/get a body's angular damping factor. The default value of this parameter is [code]0.0[/code].*/ BodyParamAngularDamp BodyParameter = 9 /*Represents the size of the [enum BodyParameter] enum.*/ BodyParamMax BodyParameter = 10 )
type BodyState ¶
type BodyState = gdclass.PhysicsServer2DBodyState //gd:PhysicsServer2D.BodyState
const ( /*Constant to set/get the current transform matrix of the body.*/ BodyStateTransform BodyState = 0 /*Constant to set/get the current linear velocity of the body.*/ BodyStateLinearVelocity BodyState = 1 /*Constant to set/get the current angular velocity of the body.*/ BodyStateAngularVelocity BodyState = 2 /*Constant to sleep/wake up a body, or to get whether it is sleeping.*/ BodyStateSleeping BodyState = 3 /*Constant to set/get whether the body can sleep.*/ BodyStateCanSleep BodyState = 4 )
type CCDMode ¶
type CCDMode = gdclass.PhysicsServer2DCCDMode //gd:PhysicsServer2D.CCDMode
const ( /*Disables continuous collision detection. This is the fastest way to detect body collisions, but it can miss small and/or fast-moving objects.*/ CcdModeDisabled CCDMode = 0 /*Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise.*/ CcdModeCastRay CCDMode = 1 /*Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise.*/ CcdModeCastShape CCDMode = 2 )
type DampedSpringParam ¶
type DampedSpringParam = gdclass.PhysicsServer2DDampedSpringParam //gd:PhysicsServer2D.DampedSpringParam
const ( /*Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. The default value of this parameter is the distance between the joint's anchor points.*/ DampedSpringRestLength DampedSpringParam = 0 /*Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. The default value of this parameter is [code]20.0[/code].*/ DampedSpringStiffness DampedSpringParam = 1 /*Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). The default value of this parameter is [code]1.5[/code].*/ DampedSpringDamping DampedSpringParam = 2 )
type JointParam ¶
type JointParam = gdclass.PhysicsServer2DJointParam //gd:PhysicsServer2D.JointParam
const ( /*Constant to set/get how fast the joint pulls the bodies back to satisfy the joint constraint. The lower the value, the more the two bodies can pull on the joint. The default value of this parameter is [code]0.0[/code]. [b]Note:[/b] In Godot Physics, this parameter is only used for pin joints and groove joints.*/ JointParamBias JointParam = 0 /*Constant to set/get the maximum speed with which the joint can apply corrections. The default value of this parameter is [code]3.40282e+38[/code]. [b]Note:[/b] In Godot Physics, this parameter is only used for groove joints.*/ JointParamMaxBias JointParam = 1 /*Constant to set/get the maximum force that the joint can use to act on the two bodies. The default value of this parameter is [code]3.40282e+38[/code]. [b]Note:[/b] In Godot Physics, this parameter is only used for groove joints.*/ JointParamMaxForce JointParam = 2 )
type JointType ¶
type JointType = gdclass.PhysicsServer2DJointType //gd:PhysicsServer2D.JointType
const ( /*Constant to create pin joints.*/ JointTypePin JointType = 0 /*Constant to create groove joints.*/ JointTypeGroove JointType = 1 /*Constant to create damped spring joints.*/ JointTypeDampedSpring JointType = 2 /*Represents the size of the [enum JointType] enum.*/ JointTypeMax JointType = 3 )
type PinJointFlag ¶
type PinJointFlag = gdclass.PhysicsServer2DPinJointFlag //gd:PhysicsServer2D.PinJointFlag
const ( /*If [code]true[/code], the pin has a maximum and a minimum rotation.*/ PinJointFlagAngularLimitEnabled PinJointFlag = 0 /*If [code]true[/code], a motor turns the pin.*/ PinJointFlagMotorEnabled PinJointFlag = 1 )
type PinJointParam ¶
type PinJointParam = gdclass.PhysicsServer2DPinJointParam //gd:PhysicsServer2D.PinJointParam
const ( /*Constant to set/get a how much the bond of the pin joint can flex. The default value of this parameter is [code]0.0[/code].*/ PinJointSoftness PinJointParam = 0 /*The maximum rotation around the pin.*/ PinJointLimitUpper PinJointParam = 1 /*The minimum rotation around the pin.*/ PinJointLimitLower PinJointParam = 2 /*Target speed for the motor. In radians per second.*/ PinJointMotorTargetVelocity PinJointParam = 3 )
type ProcessInfo ¶
type ProcessInfo = gdclass.PhysicsServer2DProcessInfo //gd:PhysicsServer2D.ProcessInfo
const ( /*Constant to get the number of objects that are not sleeping.*/ InfoActiveObjects ProcessInfo = 0 /*Constant to get the number of possible collisions.*/ InfoCollisionPairs ProcessInfo = 1 /*Constant to get the number of space regions where a collision could occur.*/ InfoIslandCount ProcessInfo = 2 )
type ShapeType ¶
type ShapeType = gdclass.PhysicsServer2DShapeType //gd:PhysicsServer2D.ShapeType
const ( /*This is the constant for creating world boundary shapes. A world boundary shape is an [i]infinite[/i] line with an origin point, and a normal. Thus, it can be used for front/behind checks.*/ ShapeWorldBoundary ShapeType = 0 /*This is the constant for creating separation ray shapes. A separation ray is defined by a length and separates itself from what is touching its far endpoint. Useful for character controllers.*/ ShapeSeparationRay ShapeType = 1 /*This is the constant for creating segment shapes. A segment shape is a [i]finite[/i] line from a point A to a point B. It can be checked for intersections.*/ ShapeSegment ShapeType = 2 /*This is the constant for creating circle shapes. A circle shape only has a radius. It can be used for intersections and inside/outside checks.*/ ShapeCircle ShapeType = 3 /*This is the constant for creating rectangle shapes. A rectangle shape is defined by a width and a height. It can be used for intersections and inside/outside checks.*/ ShapeRectangle ShapeType = 4 /*This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks.*/ ShapeCapsule ShapeType = 5 /*This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks.*/ ShapeConvexPolygon ShapeType = 6 /*This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks.*/ ShapeConcavePolygon ShapeType = 7 /*This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.*/ ShapeCustom ShapeType = 8 )
type SpaceParameter ¶
type SpaceParameter = gdclass.PhysicsServer2DSpaceParameter //gd:PhysicsServer2D.SpaceParameter
const ( /*Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_recycle_radius].*/ SpaceParamContactRecycleRadius SpaceParameter = 0 /*Constant to set/get the maximum distance a shape can be from another before they are considered separated and the contact is discarded. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_max_separation].*/ SpaceParamContactMaxSeparation SpaceParameter = 1 /*Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_max_allowed_penetration].*/ SpaceParamContactMaxAllowedPenetration SpaceParameter = 2 /*Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/default_contact_bias].*/ SpaceParamContactDefaultBias SpaceParameter = 3 /*Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. The default value of this parameter is [member ProjectSettings.physics/2d/sleep_threshold_linear].*/ SpaceParamBodyLinearVelocitySleepThreshold SpaceParameter = 4 /*Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. The default value of this parameter is [member ProjectSettings.physics/2d/sleep_threshold_angular].*/ SpaceParamBodyAngularVelocitySleepThreshold SpaceParameter = 5 /*Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. The default value of this parameter is [member ProjectSettings.physics/2d/time_before_sleep].*/ SpaceParamBodyTimeToSleep SpaceParameter = 6 /*Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/default_constraint_bias].*/ SpaceParamConstraintDefaultBias SpaceParameter = 7 /*Constant to set/get the number of solver iterations for all contacts and constraints. The greater the number of iterations, the more accurate the collisions will be. However, a greater number of iterations requires more CPU power, which can decrease performance. The default value of this parameter is [member ProjectSettings.physics/2d/solver/solver_iterations].*/ SpaceParamSolverIterations SpaceParameter = 8 )