Inheritance #

Table of contents

PhysicsServer2DExtension #

is_instantiable, core, not_builtin_classes

Provides virtual methods that can be overridden to create custom PhysicsServer2D implementations.

This class extends PhysicsServer2D by providing additional virtual methods that can be overridden. When these methods are overridden, they will be called instead of the internal methods of the physics server.

Intended for use with GDExtension to create custom implementations of PhysicsServer2D.

Members #

Methods #

virtual func _area_add_shape(disabled: bool) -> void#

Overridable version of PhysicsServer2D.area_add_shape.

virtual func _area_attach_canvas_instance_id(id: int) -> void#

Overridable version of PhysicsServer2D.area_attach_canvas_instance_id.

virtual func _area_attach_object_instance_id(id: int) -> void#

Overridable version of PhysicsServer2D.area_attach_object_instance_id.

virtual func _area_clear_shapes(area: RID) -> void#

Overridable version of PhysicsServer2D.area_clear_shapes.

virtual func _area_create() -> RID#

Overridable version of PhysicsServer2D.area_create.

virtual const func _area_get_canvas_instance_id(area: RID) -> int#

Overridable version of PhysicsServer2D.area_get_canvas_instance_id.

virtual const func _area_get_collision_layer(area: RID) -> int#

Overridable version of PhysicsServer2D.area_get_collision_layer.

virtual const func _area_get_collision_mask(area: RID) -> int#

Overridable version of PhysicsServer2D.area_get_collision_mask.

virtual const func _area_get_object_instance_id(area: RID) -> int#

Overridable version of PhysicsServer2D.area_get_object_instance_id.

virtual const func _area_get_param(param: int enumPhysicsServer2D.AreaParameter) -> Variant#

Overridable version of PhysicsServer2D.area_get_param.

virtual const func _area_get_shape(shape_idx: int) -> RID#

Overridable version of PhysicsServer2D.area_get_shape.

virtual const func _area_get_shape_count(area: RID) -> int#

Overridable version of PhysicsServer2D.area_get_shape_count.

virtual const func _area_get_shape_transform(shape_idx: int) -> Transform2D#

Overridable version of PhysicsServer2D.area_get_shape_transform.

virtual const func _area_get_space(area: RID) -> RID#

Overridable version of PhysicsServer2D.area_get_space.

virtual const func _area_get_transform(area: RID) -> Transform2D#

Overridable version of PhysicsServer2D.area_get_transform.

virtual func _area_remove_shape(shape_idx: int) -> void#

Overridable version of PhysicsServer2D.area_remove_shape.

virtual func _area_set_area_monitor_callback(callback: Callable) -> void#

Overridable version of PhysicsServer2D.area_set_area_monitor_callback.

virtual func _area_set_collision_layer(layer: int) -> void#

Overridable version of PhysicsServer2D.area_set_collision_layer.

virtual func _area_set_collision_mask(mask: int) -> void#

Overridable version of PhysicsServer2D.area_set_collision_mask.

virtual func _area_set_monitor_callback(callback: Callable) -> void#

Overridable version of PhysicsServer2D.area_set_monitor_callback.

virtual func _area_set_monitorable(monitorable: bool) -> void#

Overridable version of PhysicsServer2D.area_set_monitorable.

virtual func _area_set_param(value: Variant) -> void#

Overridable version of PhysicsServer2D.area_set_param.

virtual func _area_set_pickable(pickable: bool) -> void#

If set to true, allows the area with the given RID to detect mouse inputs when the mouse cursor is hovering on it.

Overridable version of PhysicsServer2D's internal area_set_pickable method. Corresponds to CollisionObject2D.input_pickable.

virtual func _area_set_shape(shape: RID) -> void#

Overridable version of PhysicsServer2D.area_set_shape.

virtual func _area_set_shape_disabled(disabled: bool) -> void#

Overridable version of PhysicsServer2D.area_set_shape_disabled.

virtual func _area_set_shape_transform(transform: Transform2D) -> void#

Overridable version of PhysicsServer2D.area_set_shape_transform.

virtual func _area_set_space(space: RID) -> void#

Overridable version of PhysicsServer2D.area_set_space.

virtual func _area_set_transform(transform: Transform2D) -> void#

Overridable version of PhysicsServer2D.area_set_transform.

virtual func _body_add_collision_exception(excepted_body: RID) -> void#

Overridable version of PhysicsServer2D.body_add_collision_exception.

virtual func _body_add_constant_central_force(force: Vector2) -> void#

Overridable version of PhysicsServer2D.body_add_constant_central_force.

virtual func _body_add_constant_force(position: Vector2) -> void#

Overridable version of PhysicsServer2D.body_add_constant_force.

virtual func _body_add_constant_torque(torque: float) -> void#

Overridable version of PhysicsServer2D.body_add_constant_torque.

virtual func _body_add_shape(disabled: bool) -> void#

Overridable version of PhysicsServer2D.body_add_shape.

virtual func _body_apply_central_force(force: Vector2) -> void#

Overridable version of PhysicsServer2D.body_apply_central_force.

virtual func _body_apply_central_impulse(impulse: Vector2) -> void#

Overridable version of PhysicsServer2D.body_apply_central_impulse.

virtual func _body_apply_force(position: Vector2) -> void#

Overridable version of PhysicsServer2D.body_apply_force.

virtual func _body_apply_impulse(position: Vector2) -> void#

Overridable version of PhysicsServer2D.body_apply_impulse.

virtual func _body_apply_torque(torque: float) -> void#

Overridable version of PhysicsServer2D.body_apply_torque.

virtual func _body_apply_torque_impulse(impulse: float) -> void#

Overridable version of PhysicsServer2D.body_apply_torque_impulse.

virtual func _body_attach_canvas_instance_id(id: int) -> void#

Overridable version of PhysicsServer2D.body_attach_canvas_instance_id.

virtual func _body_attach_object_instance_id(id: int) -> void#

Overridable version of PhysicsServer2D.body_attach_object_instance_id.

virtual func _body_clear_shapes(body: RID) -> void#

Overridable version of PhysicsServer2D.body_clear_shapes.

virtual func _body_collide_shape(result_count: int32_t*) -> bool#

Given a body, a shape, and their respective parameters, this method should return true if a collision between the two would occur, with additional details passed in results.

Overridable version of PhysicsServer2D's internal shape_collide method. Corresponds to PhysicsDirectSpaceState2D.collide_shape.

virtual func _body_create() -> RID#

Overridable version of PhysicsServer2D.body_create.

virtual const func _body_get_canvas_instance_id(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_canvas_instance_id.

virtual const func _body_get_collision_exceptions(body: RID) -> RID[]#

Returns the RIDs of all bodies added as collision exceptions for the given body. See also _body_add_collision_exception and _body_remove_collision_exception.

Overridable version of PhysicsServer2D's internal body_get_collision_exceptions method. Corresponds to PhysicsBody2D.get_collision_exceptions.

virtual const func _body_get_collision_layer(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_collision_layer.

virtual const func _body_get_collision_mask(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_collision_mask.

virtual const func _body_get_collision_priority(body: RID) -> float#

Overridable version of PhysicsServer2D.body_get_collision_priority.

virtual const func _body_get_constant_force(body: RID) -> Vector2#

Overridable version of PhysicsServer2D.body_get_constant_force.

virtual const func _body_get_constant_torque(body: RID) -> float#

Overridable version of PhysicsServer2D.body_get_constant_torque.

virtual const func _body_get_contacts_reported_depth_threshold(body: RID) -> float#

Overridable version of PhysicsServer2D's internal body_get_contacts_reported_depth_threshold method.

Note: This method is currently unused by Godot's default physics implementation.

virtual const func _body_get_continuous_collision_detection_mode(body: RID) -> intPhysicsServer2D.CCDMode#

Overridable version of PhysicsServer2D.body_get_continuous_collision_detection_mode.

virtual func _body_get_direct_state(body: RID) -> PhysicsDirectBodyState2D#

Overridable version of PhysicsServer2D.body_get_direct_state.

virtual const func _body_get_max_contacts_reported(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_max_contacts_reported.

virtual const func _body_get_mode(body: RID) -> intPhysicsServer2D.BodyMode#

Overridable version of PhysicsServer2D.body_get_mode.

virtual const func _body_get_object_instance_id(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_object_instance_id.

virtual const func _body_get_param(param: int enumPhysicsServer2D.BodyParameter) -> Variant#

Overridable version of PhysicsServer2D.body_get_param.

virtual const func _body_get_shape(shape_idx: int) -> RID#

Overridable version of PhysicsServer2D.body_get_shape.

virtual const func _body_get_shape_count(body: RID) -> int#

Overridable version of PhysicsServer2D.body_get_shape_count.

virtual const func _body_get_shape_transform(shape_idx: int) -> Transform2D#

Overridable version of PhysicsServer2D.body_get_shape_transform.

virtual const func _body_get_space(body: RID) -> RID#

Overridable version of PhysicsServer2D.body_get_space.

virtual const func _body_get_state(state: int enumPhysicsServer2D.BodyState) -> Variant#

Overridable version of PhysicsServer2D.body_get_state.

virtual const func _body_is_omitting_force_integration(body: RID) -> bool#

Overridable version of PhysicsServer2D.body_is_omitting_force_integration.

virtual func _body_remove_collision_exception(excepted_body: RID) -> void#

Overridable version of PhysicsServer2D.body_remove_collision_exception.

virtual func _body_remove_shape(shape_idx: int) -> void#

Overridable version of PhysicsServer2D.body_remove_shape.

virtual func _body_reset_mass_properties(body: RID) -> void#

Overridable version of PhysicsServer2D.body_reset_mass_properties.

virtual func _body_set_axis_velocity(axis_velocity: Vector2) -> void#

Overridable version of PhysicsServer2D.body_set_axis_velocity.

virtual func _body_set_collision_layer(layer: int) -> void#

Overridable version of PhysicsServer2D.body_set_collision_layer.

virtual func _body_set_collision_mask(mask: int) -> void#

Overridable version of PhysicsServer2D.body_set_collision_mask.

virtual func _body_set_collision_priority(priority: float) -> void#

Overridable version of PhysicsServer2D.body_set_collision_priority.

virtual func _body_set_constant_force(force: Vector2) -> void#

Overridable version of PhysicsServer2D.body_set_constant_force.

virtual func _body_set_constant_torque(torque: float) -> void#

Overridable version of PhysicsServer2D.body_set_constant_torque.

virtual func _body_set_contacts_reported_depth_threshold(threshold: float) -> void#

Overridable version of PhysicsServer2D's internal body_set_contacts_reported_depth_threshold method.

Note: This method is currently unused by Godot's default physics implementation.

virtual func _body_set_continuous_collision_detection_mode(mode: int enumPhysicsServer2D.CCDMode) -> void#

Overridable version of PhysicsServer2D.body_set_continuous_collision_detection_mode.

virtual func _body_set_force_integration_callback(userdata: Variant) -> void#

Overridable version of PhysicsServer2D.body_set_force_integration_callback.

virtual func _body_set_max_contacts_reported(amount: int) -> void#

Overridable version of PhysicsServer2D.body_set_max_contacts_reported.

virtual func _body_set_mode(mode: int enumPhysicsServer2D.BodyMode) -> void#

Overridable version of PhysicsServer2D.body_set_mode.

virtual func _body_set_omit_force_integration(enable: bool) -> void#

Overridable version of PhysicsServer2D.body_set_omit_force_integration.

virtual func _body_set_param(value: Variant) -> void#

Overridable version of PhysicsServer2D.body_set_param.

virtual func _body_set_pickable(pickable: bool) -> void#

If set to true, allows the body with the given RID to detect mouse inputs when the mouse cursor is hovering on it.

Overridable version of PhysicsServer2D's internal body_set_pickable method. Corresponds to CollisionObject2D.input_pickable.

virtual func _body_set_shape(shape: RID) -> void#

Overridable version of PhysicsServer2D.body_set_shape.

virtual func _body_set_shape_as_one_way_collision(margin: float) -> void#

Overridable version of PhysicsServer2D.body_set_shape_as_one_way_collision.

virtual func _body_set_shape_disabled(disabled: bool) -> void#

Overridable version of PhysicsServer2D.body_set_shape_disabled.

virtual func _body_set_shape_transform(transform: Transform2D) -> void#

Overridable version of PhysicsServer2D.body_set_shape_transform.

virtual func _body_set_space(space: RID) -> void#

Overridable version of PhysicsServer2D.body_set_space.

virtual func _body_set_state(value: Variant) -> void#

Overridable version of PhysicsServer2D.body_set_state.

virtual func _body_set_state_sync_callback(callable: Callable) -> void#

Assigns the body to call the given callable during the synchronization phase of the loop, before _step is called. See also _sync.

Overridable version of PhysicsServer2D.body_set_state_sync_callback.

virtual const func _body_test_motion(result: PhysicsServer2DExtensionMotionResult*) -> bool#

Overridable version of PhysicsServer2D.body_test_motion. Unlike the exposed implementation, this method does not receive all of the arguments inside a PhysicsTestMotionParameters2D.

virtual func _capsule_shape_create() -> RID#

Overridable version of PhysicsServer2D.capsule_shape_create.

virtual func _circle_shape_create() -> RID#

Overridable version of PhysicsServer2D.circle_shape_create.

virtual func _concave_polygon_shape_create() -> RID#

Overridable version of PhysicsServer2D.concave_polygon_shape_create.

virtual func _convex_polygon_shape_create() -> RID#

Overridable version of PhysicsServer2D.convex_polygon_shape_create.

virtual const func _damped_spring_joint_get_param(param: int enumPhysicsServer2D.DampedSpringParam) -> float#

Overridable version of PhysicsServer2D.damped_spring_joint_get_param.

virtual func _damped_spring_joint_set_param(value: float) -> void#

Overridable version of PhysicsServer2D.damped_spring_joint_set_param.

virtual func _end_sync() -> void#

Called to indicate that the physics server has stopped synchronizing. It is in the loop's iteration/physics phase, and can access physics objects even if running on a separate thread. See also _sync.

Overridable version of PhysicsServer2D's internal end_sync method.

virtual func _finish() -> void#

Called when the main loop finalizes to shut down the physics server. See also MainLoop._finalize and _init.

Overridable version of PhysicsServer2D's internal finish method.

virtual func _flush_queries() -> void#

Called every physics step before _step to process all remaining queries.

Overridable version of PhysicsServer2D's internal flush_queries method.

virtual func _free_rid(rid: RID) -> void#

Overridable version of PhysicsServer2D.free_rid.

virtual func _get_process_info(process_info: int enumPhysicsServer2D.ProcessInfo) -> int#

Overridable version of PhysicsServer2D.get_process_info.

virtual func _init() -> void#

Called when the main loop is initialized and creates a new instance of this physics server. See also MainLoop._initialize and _finish.

Overridable version of PhysicsServer2D's internal init method.

virtual const func _is_flushing_queries() -> bool#

Overridable method that should return true when the physics server is processing queries. See also _flush_queries.

Overridable version of PhysicsServer2D's internal is_flushing_queries method.

virtual func _joint_clear(joint: RID) -> void#

Overridable version of PhysicsServer2D.joint_clear.

virtual func _joint_create() -> RID#

Overridable version of PhysicsServer2D.joint_create.

virtual func _joint_disable_collisions_between_bodies(disable: bool) -> void#

Overridable version of PhysicsServer2D.joint_disable_collisions_between_bodies.

virtual const func _joint_get_param(param: int enumPhysicsServer2D.JointParam) -> float#

Overridable version of PhysicsServer2D.joint_get_param.

virtual const func _joint_get_type(joint: RID) -> intPhysicsServer2D.JointType#

Overridable version of PhysicsServer2D.joint_get_type.

virtual const func _joint_is_disabled_collisions_between_bodies(joint: RID) -> bool#

Overridable version of PhysicsServer2D.joint_is_disabled_collisions_between_bodies.

virtual func _joint_make_damped_spring(body_b: RID) -> void#

Overridable version of PhysicsServer2D.joint_make_damped_spring.

virtual func _joint_make_groove(body_b: RID) -> void#

Overridable version of PhysicsServer2D.joint_make_groove.

virtual func _joint_make_pin(body_b: RID) -> void#

Overridable version of PhysicsServer2D.joint_make_pin.

virtual func _joint_set_param(value: float) -> void#

Overridable version of PhysicsServer2D.joint_set_param.

virtual const func _pin_joint_get_flag(flag: int enumPhysicsServer2D.PinJointFlag) -> bool#

Overridable version of PhysicsServer2D.pin_joint_get_flag.

virtual const func _pin_joint_get_param(param: int enumPhysicsServer2D.PinJointParam) -> float#

Overridable version of PhysicsServer2D.pin_joint_get_param.

virtual func _pin_joint_set_flag(enabled: bool) -> void#

Overridable version of PhysicsServer2D.pin_joint_set_flag.

virtual func _pin_joint_set_param(value: float) -> void#

Overridable version of PhysicsServer2D.pin_joint_set_param.

virtual func _rectangle_shape_create() -> RID#

Overridable version of PhysicsServer2D.rectangle_shape_create.

virtual func _segment_shape_create() -> RID#

Overridable version of PhysicsServer2D.segment_shape_create.

virtual func _separation_ray_shape_create() -> RID#

Overridable version of PhysicsServer2D.separation_ray_shape_create.

virtual func _set_active(active: bool) -> void#

Overridable version of PhysicsServer2D.set_active.

virtual func _shape_collide(result_count: int32_t*) -> bool#

Given two shapes and their parameters, should return true if a collision between the two would occur, with additional details passed in results.

Overridable version of PhysicsServer2D's internal shape_collide method. Corresponds to PhysicsDirectSpaceState2D.collide_shape.

virtual const func _shape_get_custom_solver_bias(shape: RID) -> float#

Should return the custom solver bias of the given shape, which defines how much bodies are forced to separate on contact when this shape is involved.

Overridable version of PhysicsServer2D's internal shape_get_custom_solver_bias method. Corresponds to Shape2D.custom_solver_bias.

virtual const func _shape_get_data(shape: RID) -> Variant#

Overridable version of PhysicsServer2D.shape_get_data.

virtual const func _shape_get_type(shape: RID) -> intPhysicsServer2D.ShapeType#

Overridable version of PhysicsServer2D.shape_get_type.

virtual func _shape_set_custom_solver_bias(bias: float) -> void#

Should set the custom solver bias for the given shape. It defines how much bodies are forced to separate on contact.

Overridable version of PhysicsServer2D's internal shape_get_custom_solver_bias method. Corresponds to Shape2D.custom_solver_bias.

virtual func _shape_set_data(data: Variant) -> void#

Overridable version of PhysicsServer2D.shape_set_data.

virtual func _space_create() -> RID#

Overridable version of PhysicsServer2D.space_create.

virtual const func _space_get_contact_count(space: RID) -> int#

Should return how many contacts have occurred during the last physics step in the given space. See also _space_get_contacts and _space_set_debug_contacts.

Overridable version of PhysicsServer2D's internal space_get_contact_count method.

virtual const func _space_get_contacts(space: RID) -> PackedVector2Array#

Should return the positions of all contacts that have occurred during the last physics step in the given space. See also _space_get_contact_count and _space_set_debug_contacts.

Overridable version of PhysicsServer2D's internal space_get_contacts method.

virtual func _space_get_direct_state(space: RID) -> PhysicsDirectSpaceState2D#

Overridable version of PhysicsServer2D.space_get_direct_state.

virtual const func _space_get_param(param: int enumPhysicsServer2D.SpaceParameter) -> float#

Overridable version of PhysicsServer2D.space_get_param.

virtual const func _space_is_active(space: RID) -> bool#

Overridable version of PhysicsServer2D.space_is_active.

virtual func _space_set_active(active: bool) -> void#

Overridable version of PhysicsServer2D.space_set_active.

virtual func _space_set_debug_contacts(max_contacts: int) -> void#

Used internally to allow the given space to store contact points, up to max_contacts. This is automatically set for the main World2D's space when SceneTree.debug_collisions_hint is true, or by checking "Visible Collision Shapes" in the editor. Only works in debug builds.

Overridable version of PhysicsServer2D's internal space_set_debug_contacts method.

virtual func _space_set_param(value: float) -> void#

Overridable version of PhysicsServer2D.space_set_param.

virtual func _step(step: float) -> void#

Called every physics step to process the physics simulation. step is the time elapsed since the last physics step, in seconds. It is usually the same as Node.get_physics_process_delta_time.

Overridable version of PhysicsServer2D's internal [code skip-lint]step method.

virtual func _sync() -> void#

Called to indicate that the physics server is synchronizing and cannot access physics states if running on a separate thread. See also _end_sync.

Overridable version of PhysicsServer2D's internal sync method.

virtual func _world_boundary_shape_create() -> RID#

Overridable version of PhysicsServer2D.world_boundary_shape_create.

const func body_test_motion_is_excluding_body(body: RID) -> bool#

Returns true if the body with the given RID is being excluded from _body_test_motion. See also Object.get_instance_id.

const func body_test_motion_is_excluding_object(object: int) -> bool#

Returns true if the object with the given instance ID is being excluded from _body_test_motion. See also Object.get_instance_id.

Annotations #

Constants #

Constructors #

Enums #

Operators #

Signals #

Theme Items #

Tutorials #