Trait IPhysicsServer2DExtension
pub trait IPhysicsServer2DExtension: GodotClass<Base = PhysicsServer2DExtension> + You_forgot_the_attribute__godot_api {
Show 146 methods
// Required methods
fn world_boundary_shape_create(&mut self) -> Rid;
fn separation_ray_shape_create(&mut self) -> Rid;
fn segment_shape_create(&mut self) -> Rid;
fn circle_shape_create(&mut self) -> Rid;
fn rectangle_shape_create(&mut self) -> Rid;
fn capsule_shape_create(&mut self) -> Rid;
fn convex_polygon_shape_create(&mut self) -> Rid;
fn concave_polygon_shape_create(&mut self) -> Rid;
fn shape_set_data(&mut self, shape: Rid, data: Variant);
fn shape_set_custom_solver_bias(&mut self, shape: Rid, bias: f32);
fn shape_get_type(&self, shape: Rid) -> ShapeType;
fn shape_get_data(&self, shape: Rid) -> Variant;
fn shape_get_custom_solver_bias(&self, shape: Rid) -> f32;
unsafe fn shape_collide_rawptr(
&mut self,
shape_A: Rid,
xform_A: Transform2D,
motion_A: Vector2,
shape_B: Rid,
xform_B: Transform2D,
motion_B: Vector2,
results: RawPtr<*mut c_void>,
result_max: i32,
result_count: RawPtr<*mut i32>,
) -> bool;
fn space_create(&mut self) -> Rid;
fn space_set_active(&mut self, space: Rid, active: bool);
fn space_is_active(&self, space: Rid) -> bool;
fn space_set_param(&mut self, space: Rid, param: SpaceParameter, value: f32);
fn space_get_param(&self, space: Rid, param: SpaceParameter) -> f32;
fn space_get_direct_state(
&mut self,
space: Rid,
) -> Option<Gd<PhysicsDirectSpaceState2D>>;
fn space_set_debug_contacts(&mut self, space: Rid, max_contacts: i32);
fn space_get_contacts(&self, space: Rid) -> PackedArray<Vector2>;
fn space_get_contact_count(&self, space: Rid) -> i32;
fn area_create(&mut self) -> Rid;
fn area_set_space(&mut self, area: Rid, space: Rid);
fn area_get_space(&self, area: Rid) -> Rid;
fn area_add_shape(
&mut self,
area: Rid,
shape: Rid,
transform: Transform2D,
disabled: bool,
);
fn area_set_shape(&mut self, area: Rid, shape_idx: i32, shape: Rid);
fn area_set_shape_transform(
&mut self,
area: Rid,
shape_idx: i32,
transform: Transform2D,
);
fn area_set_shape_disabled(
&mut self,
area: Rid,
shape_idx: i32,
disabled: bool,
);
fn area_get_shape_count(&self, area: Rid) -> i32;
fn area_get_shape(&self, area: Rid, shape_idx: i32) -> Rid;
fn area_get_shape_transform(&self, area: Rid, shape_idx: i32) -> Transform2D;
fn area_remove_shape(&mut self, area: Rid, shape_idx: i32);
fn area_clear_shapes(&mut self, area: Rid);
fn area_attach_object_instance_id(&mut self, area: Rid, id: u64);
fn area_get_object_instance_id(&self, area: Rid) -> u64;
fn area_attach_canvas_instance_id(&mut self, area: Rid, id: u64);
fn area_get_canvas_instance_id(&self, area: Rid) -> u64;
fn area_set_param(
&mut self,
area: Rid,
param: AreaParameter,
value: Variant,
);
fn area_set_transform(&mut self, area: Rid, transform: Transform2D);
fn area_get_param(&self, area: Rid, param: AreaParameter) -> Variant;
fn area_get_transform(&self, area: Rid) -> Transform2D;
fn area_set_collision_layer(&mut self, area: Rid, layer: u32);
fn area_get_collision_layer(&self, area: Rid) -> u32;
fn area_set_collision_mask(&mut self, area: Rid, mask: u32);
fn area_get_collision_mask(&self, area: Rid) -> u32;
fn area_set_monitorable(&mut self, area: Rid, monitorable: bool);
fn area_set_pickable(&mut self, area: Rid, pickable: bool);
fn area_set_monitor_callback(&mut self, area: Rid, callback: Callable);
fn area_set_area_monitor_callback(&mut self, area: Rid, callback: Callable);
fn body_create(&mut self) -> Rid;
fn body_set_space(&mut self, body: Rid, space: Rid);
fn body_get_space(&self, body: Rid) -> Rid;
fn body_set_mode(&mut self, body: Rid, mode: BodyMode);
fn body_get_mode(&self, body: Rid) -> BodyMode;
fn body_add_shape(
&mut self,
body: Rid,
shape: Rid,
transform: Transform2D,
disabled: bool,
);
fn body_set_shape(&mut self, body: Rid, shape_idx: i32, shape: Rid);
fn body_set_shape_transform(
&mut self,
body: Rid,
shape_idx: i32,
transform: Transform2D,
);
fn body_get_shape_count(&self, body: Rid) -> i32;
fn body_get_shape(&self, body: Rid, shape_idx: i32) -> Rid;
fn body_get_shape_transform(&self, body: Rid, shape_idx: i32) -> Transform2D;
fn body_set_shape_disabled(
&mut self,
body: Rid,
shape_idx: i32,
disabled: bool,
);
fn body_set_shape_as_one_way_collision(
&mut self,
body: Rid,
shape_idx: i32,
enable: bool,
margin: f32,
);
fn body_remove_shape(&mut self, body: Rid, shape_idx: i32);
fn body_clear_shapes(&mut self, body: Rid);
fn body_attach_object_instance_id(&mut self, body: Rid, id: u64);
fn body_get_object_instance_id(&self, body: Rid) -> u64;
fn body_attach_canvas_instance_id(&mut self, body: Rid, id: u64);
fn body_get_canvas_instance_id(&self, body: Rid) -> u64;
fn body_set_continuous_collision_detection_mode(
&mut self,
body: Rid,
mode: CcdMode,
);
fn body_get_continuous_collision_detection_mode(&self, body: Rid) -> CcdMode;
fn body_set_collision_layer(&mut self, body: Rid, layer: u32);
fn body_get_collision_layer(&self, body: Rid) -> u32;
fn body_set_collision_mask(&mut self, body: Rid, mask: u32);
fn body_get_collision_mask(&self, body: Rid) -> u32;
fn body_set_collision_priority(&mut self, body: Rid, priority: f32);
fn body_get_collision_priority(&self, body: Rid) -> f32;
fn body_set_param(
&mut self,
body: Rid,
param: BodyParameter,
value: Variant,
);
fn body_get_param(&self, body: Rid, param: BodyParameter) -> Variant;
fn body_reset_mass_properties(&mut self, body: Rid);
fn body_set_state(&mut self, body: Rid, state: BodyState, value: Variant);
fn body_get_state(&self, body: Rid, state: BodyState) -> Variant;
fn body_apply_central_impulse(&mut self, body: Rid, impulse: Vector2);
fn body_apply_torque_impulse(&mut self, body: Rid, impulse: f32);
fn body_apply_impulse(
&mut self,
body: Rid,
impulse: Vector2,
position: Vector2,
);
fn body_apply_central_force(&mut self, body: Rid, force: Vector2);
fn body_apply_force(&mut self, body: Rid, force: Vector2, position: Vector2);
fn body_apply_torque(&mut self, body: Rid, torque: f32);
fn body_add_constant_central_force(&mut self, body: Rid, force: Vector2);
fn body_add_constant_force(
&mut self,
body: Rid,
force: Vector2,
position: Vector2,
);
fn body_add_constant_torque(&mut self, body: Rid, torque: f32);
fn body_set_constant_force(&mut self, body: Rid, force: Vector2);
fn body_get_constant_force(&self, body: Rid) -> Vector2;
fn body_set_constant_torque(&mut self, body: Rid, torque: f32);
fn body_get_constant_torque(&self, body: Rid) -> f32;
fn body_set_axis_velocity(&mut self, body: Rid, axis_velocity: Vector2);
fn body_add_collision_exception(&mut self, body: Rid, excepted_body: Rid);
fn body_remove_collision_exception(&mut self, body: Rid, excepted_body: Rid);
fn body_get_collision_exceptions(&self, body: Rid) -> Array<Rid>;
fn body_set_max_contacts_reported(&mut self, body: Rid, amount: i32);
fn body_get_max_contacts_reported(&self, body: Rid) -> i32;
fn body_set_contacts_reported_depth_threshold(
&mut self,
body: Rid,
threshold: f32,
);
fn body_get_contacts_reported_depth_threshold(&self, body: Rid) -> f32;
fn body_set_omit_force_integration(&mut self, body: Rid, enable: bool);
fn body_is_omitting_force_integration(&self, body: Rid) -> bool;
fn body_set_state_sync_callback(&mut self, body: Rid, callable: Callable);
fn body_set_force_integration_callback(
&mut self,
body: Rid,
callable: Callable,
userdata: Variant,
);
unsafe fn body_collide_shape_rawptr(
&mut self,
body: Rid,
body_shape: i32,
shape: Rid,
shape_xform: Transform2D,
motion: Vector2,
results: RawPtr<*mut c_void>,
result_max: i32,
result_count: RawPtr<*mut i32>,
) -> bool;
fn body_set_pickable(&mut self, body: Rid, pickable: bool);
fn body_get_direct_state(
&mut self,
body: Rid,
) -> Option<Gd<PhysicsDirectBodyState2D>>;
unsafe fn body_test_motion_rawptr(
&self,
body: Rid,
from: Transform2D,
motion: Vector2,
margin: f32,
collide_separation_ray: bool,
recovery_as_collision: bool,
result: RawPtr<*mut PhysicsServer2DExtensionMotionResult>,
) -> bool;
fn joint_create(&mut self) -> Rid;
fn joint_clear(&mut self, joint: Rid);
fn joint_set_param(&mut self, joint: Rid, param: JointParam, value: f32);
fn joint_get_param(&self, joint: Rid, param: JointParam) -> f32;
fn joint_disable_collisions_between_bodies(
&mut self,
joint: Rid,
disable: bool,
);
fn joint_is_disabled_collisions_between_bodies(&self, joint: Rid) -> bool;
fn joint_make_pin(
&mut self,
joint: Rid,
anchor: Vector2,
body_a: Rid,
body_b: Rid,
);
fn joint_make_groove(
&mut self,
joint: Rid,
a_groove1: Vector2,
a_groove2: Vector2,
b_anchor: Vector2,
body_a: Rid,
body_b: Rid,
);
fn joint_make_damped_spring(
&mut self,
joint: Rid,
anchor_a: Vector2,
anchor_b: Vector2,
body_a: Rid,
body_b: Rid,
);
fn pin_joint_set_flag(
&mut self,
joint: Rid,
flag: PinJointFlag,
enabled: bool,
);
fn pin_joint_get_flag(&self, joint: Rid, flag: PinJointFlag) -> bool;
fn pin_joint_set_param(
&mut self,
joint: Rid,
param: PinJointParam,
value: f32,
);
fn pin_joint_get_param(&self, joint: Rid, param: PinJointParam) -> f32;
fn damped_spring_joint_set_param(
&mut self,
joint: Rid,
param: DampedSpringParam,
value: f32,
);
fn damped_spring_joint_get_param(
&self,
joint: Rid,
param: DampedSpringParam,
) -> f32;
fn joint_get_type(&self, joint: Rid) -> JointType;
fn free_rid(&mut self, rid: Rid);
fn set_active(&mut self, active: bool);
fn init_ext(&mut self);
fn step(&mut self, step: f32);
fn sync(&mut self);
fn flush_queries(&mut self);
fn end_sync(&mut self);
fn finish(&mut self);
fn is_flushing_queries(&self) -> bool;
fn get_process_info(&mut self, process_info: ProcessInfo) -> i32;
// Provided methods
fn init(base: Base<Self::Base>) -> Self { ... }
fn on_notification(&mut self, what: ObjectNotification) { ... }
fn on_get(&self, property: StringName) -> Option<Variant> { ... }
fn on_set(&mut self, property: StringName, value: Variant) -> bool { ... }
fn on_validate_property(&self, property: &mut PropertyInfo) { ... }
fn on_get_property_list(&mut self) -> Vec<PropertyInfo> { ... }
fn on_property_get_revert(&self, property: StringName) -> Option<Variant> { ... }
fn to_string(&self) -> GString { ... }
}Expand description
§Interface trait for class PhysicsServer2DExtension.
Functions in this trait represent constructors (init) or virtual method callbacks invoked by the engine.
§Related symbols
Base interfaces: > IPhysicsServer2DIObject.
(Strike-through means some intermediate Godot classes are marked final, and can thus not be inherited by GDExtension.)
Required Methods§
fn world_boundary_shape_create(&mut self) -> Rid
fn world_boundary_shape_create(&mut self) -> Rid
Overridable version of world_boundary_shape_create.
fn separation_ray_shape_create(&mut self) -> Rid
fn separation_ray_shape_create(&mut self) -> Rid
Overridable version of separation_ray_shape_create.
fn segment_shape_create(&mut self) -> Rid
fn segment_shape_create(&mut self) -> Rid
Overridable version of segment_shape_create.
fn circle_shape_create(&mut self) -> Rid
fn circle_shape_create(&mut self) -> Rid
Overridable version of circle_shape_create.
fn rectangle_shape_create(&mut self) -> Rid
fn rectangle_shape_create(&mut self) -> Rid
Overridable version of rectangle_shape_create.
fn capsule_shape_create(&mut self) -> Rid
fn capsule_shape_create(&mut self) -> Rid
Overridable version of capsule_shape_create.
fn convex_polygon_shape_create(&mut self) -> Rid
fn convex_polygon_shape_create(&mut self) -> Rid
Overridable version of convex_polygon_shape_create.
fn concave_polygon_shape_create(&mut self) -> Rid
fn concave_polygon_shape_create(&mut self) -> Rid
Overridable version of concave_polygon_shape_create.
fn shape_set_data(&mut self, shape: Rid, data: Variant)
fn shape_set_data(&mut self, shape: Rid, data: Variant)
Overridable version of shape_set_data.
fn shape_set_custom_solver_bias(&mut self, shape: Rid, bias: f32)
fn shape_set_custom_solver_bias(&mut self, shape: Rid, bias: f32)
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 [member Shape2D.custom_solver_bias].
fn shape_get_type(&self, shape: Rid) -> ShapeType
fn shape_get_type(&self, shape: Rid) -> ShapeType
Overridable version of shape_get_type.
fn shape_get_data(&self, shape: Rid) -> Variant
fn shape_get_data(&self, shape: Rid) -> Variant
Overridable version of shape_get_data.
fn shape_get_custom_solver_bias(&self, shape: Rid) -> f32
fn shape_get_custom_solver_bias(&self, shape: Rid) -> f32
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 [member Shape2D.custom_solver_bias].
unsafe fn shape_collide_rawptr(
&mut self,
shape_A: Rid,
xform_A: Transform2D,
motion_A: Vector2,
shape_B: Rid,
xform_B: Transform2D,
motion_B: Vector2,
results: RawPtr<*mut c_void>,
result_max: i32,
result_count: RawPtr<*mut i32>,
) -> bool
unsafe fn shape_collide_rawptr( &mut self, shape_A: Rid, xform_A: Transform2D, motion_A: Vector2, shape_B: Rid, xform_B: Transform2D, motion_B: Vector2, results: RawPtr<*mut c_void>, result_max: i32, result_count: RawPtr<*mut i32>, ) -> bool
§Godot docs
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 collide_shape.
§Safety
This method has automatically been marked unsafe because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
fn space_create(&mut self) -> Rid
fn space_create(&mut self) -> Rid
Overridable version of space_create.
fn space_set_active(&mut self, space: Rid, active: bool)
fn space_set_active(&mut self, space: Rid, active: bool)
Overridable version of space_set_active.
fn space_is_active(&self, space: Rid) -> bool
fn space_is_active(&self, space: Rid) -> bool
Overridable version of space_is_active.
fn space_set_param(&mut self, space: Rid, param: SpaceParameter, value: f32)
fn space_set_param(&mut self, space: Rid, param: SpaceParameter, value: f32)
Overridable version of space_set_param.
fn space_get_param(&self, space: Rid, param: SpaceParameter) -> f32
fn space_get_param(&self, space: Rid, param: SpaceParameter) -> f32
Overridable version of space_get_param.
fn space_get_direct_state(
&mut self,
space: Rid,
) -> Option<Gd<PhysicsDirectSpaceState2D>>
fn space_get_direct_state( &mut self, space: Rid, ) -> Option<Gd<PhysicsDirectSpaceState2D>>
Overridable version of space_get_direct_state.
fn space_set_debug_contacts(&mut self, space: Rid, max_contacts: i32)
fn space_set_debug_contacts(&mut self, space: Rid, max_contacts: i32)
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 [member 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.
fn space_get_contacts(&self, space: Rid) -> PackedArray<Vector2>
fn space_get_contacts(&self, space: Rid) -> PackedArray<Vector2>
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.
fn space_get_contact_count(&self, space: Rid) -> i32
fn space_get_contact_count(&self, space: Rid) -> i32
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.
fn area_create(&mut self) -> Rid
fn area_create(&mut self) -> Rid
Overridable version of area_create.
fn area_set_space(&mut self, area: Rid, space: Rid)
fn area_set_space(&mut self, area: Rid, space: Rid)
Overridable version of area_set_space.
fn area_get_space(&self, area: Rid) -> Rid
fn area_get_space(&self, area: Rid) -> Rid
Overridable version of area_get_space.
fn area_add_shape(
&mut self,
area: Rid,
shape: Rid,
transform: Transform2D,
disabled: bool,
)
fn area_add_shape( &mut self, area: Rid, shape: Rid, transform: Transform2D, disabled: bool, )
Overridable version of area_add_shape.
fn area_set_shape(&mut self, area: Rid, shape_idx: i32, shape: Rid)
fn area_set_shape(&mut self, area: Rid, shape_idx: i32, shape: Rid)
Overridable version of area_set_shape.
fn area_set_shape_transform(
&mut self,
area: Rid,
shape_idx: i32,
transform: Transform2D,
)
fn area_set_shape_transform( &mut self, area: Rid, shape_idx: i32, transform: Transform2D, )
Overridable version of area_set_shape_transform.
fn area_set_shape_disabled(&mut self, area: Rid, shape_idx: i32, disabled: bool)
fn area_set_shape_disabled(&mut self, area: Rid, shape_idx: i32, disabled: bool)
Overridable version of area_set_shape_disabled.
fn area_get_shape_count(&self, area: Rid) -> i32
fn area_get_shape_count(&self, area: Rid) -> i32
Overridable version of area_get_shape_count.
fn area_get_shape(&self, area: Rid, shape_idx: i32) -> Rid
fn area_get_shape(&self, area: Rid, shape_idx: i32) -> Rid
Overridable version of area_get_shape.
fn area_get_shape_transform(&self, area: Rid, shape_idx: i32) -> Transform2D
fn area_get_shape_transform(&self, area: Rid, shape_idx: i32) -> Transform2D
Overridable version of area_get_shape_transform.
fn area_remove_shape(&mut self, area: Rid, shape_idx: i32)
fn area_remove_shape(&mut self, area: Rid, shape_idx: i32)
Overridable version of area_remove_shape.
fn area_clear_shapes(&mut self, area: Rid)
fn area_clear_shapes(&mut self, area: Rid)
Overridable version of area_clear_shapes.
fn area_attach_object_instance_id(&mut self, area: Rid, id: u64)
fn area_attach_object_instance_id(&mut self, area: Rid, id: u64)
Overridable version of area_attach_object_instance_id.
fn area_get_object_instance_id(&self, area: Rid) -> u64
fn area_get_object_instance_id(&self, area: Rid) -> u64
Overridable version of area_get_object_instance_id.
fn area_attach_canvas_instance_id(&mut self, area: Rid, id: u64)
fn area_attach_canvas_instance_id(&mut self, area: Rid, id: u64)
Overridable version of area_attach_canvas_instance_id.
fn area_get_canvas_instance_id(&self, area: Rid) -> u64
fn area_get_canvas_instance_id(&self, area: Rid) -> u64
Overridable version of area_get_canvas_instance_id.
fn area_set_param(&mut self, area: Rid, param: AreaParameter, value: Variant)
fn area_set_param(&mut self, area: Rid, param: AreaParameter, value: Variant)
Overridable version of area_set_param.
fn area_set_transform(&mut self, area: Rid, transform: Transform2D)
fn area_set_transform(&mut self, area: Rid, transform: Transform2D)
Overridable version of area_set_transform.
fn area_get_param(&self, area: Rid, param: AreaParameter) -> Variant
fn area_get_param(&self, area: Rid, param: AreaParameter) -> Variant
Overridable version of area_get_param.
fn area_get_transform(&self, area: Rid) -> Transform2D
fn area_get_transform(&self, area: Rid) -> Transform2D
Overridable version of area_get_transform.
fn area_set_collision_layer(&mut self, area: Rid, layer: u32)
fn area_set_collision_layer(&mut self, area: Rid, layer: u32)
Overridable version of area_set_collision_layer.
fn area_get_collision_layer(&self, area: Rid) -> u32
fn area_get_collision_layer(&self, area: Rid) -> u32
Overridable version of area_get_collision_layer.
fn area_set_collision_mask(&mut self, area: Rid, mask: u32)
fn area_set_collision_mask(&mut self, area: Rid, mask: u32)
Overridable version of area_set_collision_mask.
fn area_get_collision_mask(&self, area: Rid) -> u32
fn area_get_collision_mask(&self, area: Rid) -> u32
Overridable version of area_get_collision_mask.
fn area_set_monitorable(&mut self, area: Rid, monitorable: bool)
fn area_set_monitorable(&mut self, area: Rid, monitorable: bool)
Overridable version of area_set_monitorable.
fn area_set_pickable(&mut self, area: Rid, pickable: bool)
fn area_set_pickable(&mut self, area: Rid, pickable: bool)
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 [member CollisionObject2D.input_pickable].
fn area_set_monitor_callback(&mut self, area: Rid, callback: Callable)
fn area_set_monitor_callback(&mut self, area: Rid, callback: Callable)
Overridable version of area_set_monitor_callback.
fn area_set_area_monitor_callback(&mut self, area: Rid, callback: Callable)
fn area_set_area_monitor_callback(&mut self, area: Rid, callback: Callable)
Overridable version of area_set_area_monitor_callback.
fn body_create(&mut self) -> Rid
fn body_create(&mut self) -> Rid
Overridable version of body_create.
fn body_set_space(&mut self, body: Rid, space: Rid)
fn body_set_space(&mut self, body: Rid, space: Rid)
Overridable version of body_set_space.
fn body_get_space(&self, body: Rid) -> Rid
fn body_get_space(&self, body: Rid) -> Rid
Overridable version of body_get_space.
fn body_set_mode(&mut self, body: Rid, mode: BodyMode)
fn body_set_mode(&mut self, body: Rid, mode: BodyMode)
Overridable version of body_set_mode.
fn body_get_mode(&self, body: Rid) -> BodyMode
fn body_get_mode(&self, body: Rid) -> BodyMode
Overridable version of body_get_mode.
fn body_add_shape(
&mut self,
body: Rid,
shape: Rid,
transform: Transform2D,
disabled: bool,
)
fn body_add_shape( &mut self, body: Rid, shape: Rid, transform: Transform2D, disabled: bool, )
Overridable version of body_add_shape.
fn body_set_shape(&mut self, body: Rid, shape_idx: i32, shape: Rid)
fn body_set_shape(&mut self, body: Rid, shape_idx: i32, shape: Rid)
Overridable version of body_set_shape.
fn body_set_shape_transform(
&mut self,
body: Rid,
shape_idx: i32,
transform: Transform2D,
)
fn body_set_shape_transform( &mut self, body: Rid, shape_idx: i32, transform: Transform2D, )
Overridable version of body_set_shape_transform.
fn body_get_shape_count(&self, body: Rid) -> i32
fn body_get_shape_count(&self, body: Rid) -> i32
Overridable version of body_get_shape_count.
fn body_get_shape(&self, body: Rid, shape_idx: i32) -> Rid
fn body_get_shape(&self, body: Rid, shape_idx: i32) -> Rid
Overridable version of body_get_shape.
fn body_get_shape_transform(&self, body: Rid, shape_idx: i32) -> Transform2D
fn body_get_shape_transform(&self, body: Rid, shape_idx: i32) -> Transform2D
Overridable version of body_get_shape_transform.
fn body_set_shape_disabled(&mut self, body: Rid, shape_idx: i32, disabled: bool)
fn body_set_shape_disabled(&mut self, body: Rid, shape_idx: i32, disabled: bool)
Overridable version of body_set_shape_disabled.
fn body_set_shape_as_one_way_collision(
&mut self,
body: Rid,
shape_idx: i32,
enable: bool,
margin: f32,
)
fn body_set_shape_as_one_way_collision( &mut self, body: Rid, shape_idx: i32, enable: bool, margin: f32, )
Overridable version of body_set_shape_as_one_way_collision.
fn body_remove_shape(&mut self, body: Rid, shape_idx: i32)
fn body_remove_shape(&mut self, body: Rid, shape_idx: i32)
Overridable version of body_remove_shape.
fn body_clear_shapes(&mut self, body: Rid)
fn body_clear_shapes(&mut self, body: Rid)
Overridable version of body_clear_shapes.
fn body_attach_object_instance_id(&mut self, body: Rid, id: u64)
fn body_attach_object_instance_id(&mut self, body: Rid, id: u64)
Overridable version of body_attach_object_instance_id.
fn body_get_object_instance_id(&self, body: Rid) -> u64
fn body_get_object_instance_id(&self, body: Rid) -> u64
Overridable version of body_get_object_instance_id.
fn body_attach_canvas_instance_id(&mut self, body: Rid, id: u64)
fn body_attach_canvas_instance_id(&mut self, body: Rid, id: u64)
Overridable version of body_attach_canvas_instance_id.
fn body_get_canvas_instance_id(&self, body: Rid) -> u64
fn body_get_canvas_instance_id(&self, body: Rid) -> u64
Overridable version of body_get_canvas_instance_id.
fn body_set_continuous_collision_detection_mode(
&mut self,
body: Rid,
mode: CcdMode,
)
fn body_set_continuous_collision_detection_mode( &mut self, body: Rid, mode: CcdMode, )
Overridable version of body_set_continuous_collision_detection_mode.
fn body_get_continuous_collision_detection_mode(&self, body: Rid) -> CcdMode
fn body_get_continuous_collision_detection_mode(&self, body: Rid) -> CcdMode
Overridable version of body_get_continuous_collision_detection_mode.
fn body_set_collision_layer(&mut self, body: Rid, layer: u32)
fn body_set_collision_layer(&mut self, body: Rid, layer: u32)
Overridable version of body_set_collision_layer.
fn body_get_collision_layer(&self, body: Rid) -> u32
fn body_get_collision_layer(&self, body: Rid) -> u32
Overridable version of body_get_collision_layer.
fn body_set_collision_mask(&mut self, body: Rid, mask: u32)
fn body_set_collision_mask(&mut self, body: Rid, mask: u32)
Overridable version of body_set_collision_mask.
fn body_get_collision_mask(&self, body: Rid) -> u32
fn body_get_collision_mask(&self, body: Rid) -> u32
Overridable version of body_get_collision_mask.
fn body_set_collision_priority(&mut self, body: Rid, priority: f32)
fn body_set_collision_priority(&mut self, body: Rid, priority: f32)
Overridable version of body_set_collision_priority.
fn body_get_collision_priority(&self, body: Rid) -> f32
fn body_get_collision_priority(&self, body: Rid) -> f32
Overridable version of body_get_collision_priority.
fn body_set_param(&mut self, body: Rid, param: BodyParameter, value: Variant)
fn body_set_param(&mut self, body: Rid, param: BodyParameter, value: Variant)
Overridable version of body_set_param.
fn body_get_param(&self, body: Rid, param: BodyParameter) -> Variant
fn body_get_param(&self, body: Rid, param: BodyParameter) -> Variant
Overridable version of body_get_param.
fn body_reset_mass_properties(&mut self, body: Rid)
fn body_reset_mass_properties(&mut self, body: Rid)
Overridable version of body_reset_mass_properties.
fn body_set_state(&mut self, body: Rid, state: BodyState, value: Variant)
fn body_set_state(&mut self, body: Rid, state: BodyState, value: Variant)
Overridable version of body_set_state.
fn body_get_state(&self, body: Rid, state: BodyState) -> Variant
fn body_get_state(&self, body: Rid, state: BodyState) -> Variant
Overridable version of body_get_state.
fn body_apply_central_impulse(&mut self, body: Rid, impulse: Vector2)
fn body_apply_central_impulse(&mut self, body: Rid, impulse: Vector2)
Overridable version of body_apply_central_impulse.
fn body_apply_torque_impulse(&mut self, body: Rid, impulse: f32)
fn body_apply_torque_impulse(&mut self, body: Rid, impulse: f32)
Overridable version of body_apply_torque_impulse.
fn body_apply_impulse(&mut self, body: Rid, impulse: Vector2, position: Vector2)
fn body_apply_impulse(&mut self, body: Rid, impulse: Vector2, position: Vector2)
Overridable version of body_apply_impulse.
fn body_apply_central_force(&mut self, body: Rid, force: Vector2)
fn body_apply_central_force(&mut self, body: Rid, force: Vector2)
Overridable version of body_apply_central_force.
fn body_apply_force(&mut self, body: Rid, force: Vector2, position: Vector2)
fn body_apply_force(&mut self, body: Rid, force: Vector2, position: Vector2)
Overridable version of body_apply_force.
fn body_apply_torque(&mut self, body: Rid, torque: f32)
fn body_apply_torque(&mut self, body: Rid, torque: f32)
Overridable version of body_apply_torque.
fn body_add_constant_central_force(&mut self, body: Rid, force: Vector2)
fn body_add_constant_central_force(&mut self, body: Rid, force: Vector2)
Overridable version of body_add_constant_central_force.
fn body_add_constant_force(
&mut self,
body: Rid,
force: Vector2,
position: Vector2,
)
fn body_add_constant_force( &mut self, body: Rid, force: Vector2, position: Vector2, )
Overridable version of body_add_constant_force.
fn body_add_constant_torque(&mut self, body: Rid, torque: f32)
fn body_add_constant_torque(&mut self, body: Rid, torque: f32)
Overridable version of body_add_constant_torque.
fn body_set_constant_force(&mut self, body: Rid, force: Vector2)
fn body_set_constant_force(&mut self, body: Rid, force: Vector2)
Overridable version of body_set_constant_force.
fn body_get_constant_force(&self, body: Rid) -> Vector2
fn body_get_constant_force(&self, body: Rid) -> Vector2
Overridable version of body_get_constant_force.
fn body_set_constant_torque(&mut self, body: Rid, torque: f32)
fn body_set_constant_torque(&mut self, body: Rid, torque: f32)
Overridable version of body_set_constant_torque.
fn body_get_constant_torque(&self, body: Rid) -> f32
fn body_get_constant_torque(&self, body: Rid) -> f32
Overridable version of body_get_constant_torque.
fn body_set_axis_velocity(&mut self, body: Rid, axis_velocity: Vector2)
fn body_set_axis_velocity(&mut self, body: Rid, axis_velocity: Vector2)
Overridable version of body_set_axis_velocity.
fn body_add_collision_exception(&mut self, body: Rid, excepted_body: Rid)
fn body_add_collision_exception(&mut self, body: Rid, excepted_body: Rid)
Overridable version of body_add_collision_exception.
fn body_remove_collision_exception(&mut self, body: Rid, excepted_body: Rid)
fn body_remove_collision_exception(&mut self, body: Rid, excepted_body: Rid)
Overridable version of body_remove_collision_exception.
fn body_get_collision_exceptions(&self, body: Rid) -> Array<Rid>
fn body_get_collision_exceptions(&self, body: Rid) -> Array<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 get_collision_exceptions.
fn body_set_max_contacts_reported(&mut self, body: Rid, amount: i32)
fn body_set_max_contacts_reported(&mut self, body: Rid, amount: i32)
Overridable version of body_set_max_contacts_reported.
fn body_get_max_contacts_reported(&self, body: Rid) -> i32
fn body_get_max_contacts_reported(&self, body: Rid) -> i32
Overridable version of body_get_max_contacts_reported.
fn body_set_contacts_reported_depth_threshold(
&mut self,
body: Rid,
threshold: f32,
)
fn body_set_contacts_reported_depth_threshold( &mut self, body: Rid, threshold: f32, )
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.
fn body_get_contacts_reported_depth_threshold(&self, body: Rid) -> f32
fn body_get_contacts_reported_depth_threshold(&self, body: Rid) -> f32
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.
fn body_set_omit_force_integration(&mut self, body: Rid, enable: bool)
fn body_set_omit_force_integration(&mut self, body: Rid, enable: bool)
Overridable version of body_set_omit_force_integration.
fn body_is_omitting_force_integration(&self, body: Rid) -> bool
fn body_is_omitting_force_integration(&self, body: Rid) -> bool
Overridable version of body_is_omitting_force_integration.
fn body_set_state_sync_callback(&mut self, body: Rid, callable: Callable)
fn body_set_state_sync_callback(&mut self, body: Rid, callable: Callable)
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 body_set_state_sync_callback.
fn body_set_force_integration_callback(
&mut self,
body: Rid,
callable: Callable,
userdata: Variant,
)
fn body_set_force_integration_callback( &mut self, body: Rid, callable: Callable, userdata: Variant, )
Overridable version of body_set_force_integration_callback.
unsafe fn body_collide_shape_rawptr(
&mut self,
body: Rid,
body_shape: i32,
shape: Rid,
shape_xform: Transform2D,
motion: Vector2,
results: RawPtr<*mut c_void>,
result_max: i32,
result_count: RawPtr<*mut i32>,
) -> bool
unsafe fn body_collide_shape_rawptr( &mut self, body: Rid, body_shape: i32, shape: Rid, shape_xform: Transform2D, motion: Vector2, results: RawPtr<*mut c_void>, result_max: i32, result_count: RawPtr<*mut i32>, ) -> bool
§Godot docs
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 collide_shape.
§Safety
This method has automatically been marked unsafe because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
fn body_set_pickable(&mut self, body: Rid, pickable: bool)
fn body_set_pickable(&mut self, body: Rid, pickable: bool)
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 [member CollisionObject2D.input_pickable].
fn body_get_direct_state(
&mut self,
body: Rid,
) -> Option<Gd<PhysicsDirectBodyState2D>>
fn body_get_direct_state( &mut self, body: Rid, ) -> Option<Gd<PhysicsDirectBodyState2D>>
Overridable version of body_get_direct_state.
unsafe fn body_test_motion_rawptr(
&self,
body: Rid,
from: Transform2D,
motion: Vector2,
margin: f32,
collide_separation_ray: bool,
recovery_as_collision: bool,
result: RawPtr<*mut PhysicsServer2DExtensionMotionResult>,
) -> bool
unsafe fn body_test_motion_rawptr( &self, body: Rid, from: Transform2D, motion: Vector2, margin: f32, collide_separation_ray: bool, recovery_as_collision: bool, result: RawPtr<*mut PhysicsServer2DExtensionMotionResult>, ) -> bool
§Godot docs
Overridable version of body_test_motion. Unlike the exposed implementation, this method does not receive all of the arguments inside a PhysicsTestMotionParameters2D.
§Safety
This method has automatically been marked unsafe because it accepts raw pointers as parameters.
If Godot does not document any safety requirements, make sure you understand the underlying semantics.
fn joint_create(&mut self) -> Rid
fn joint_create(&mut self) -> Rid
Overridable version of joint_create.
fn joint_clear(&mut self, joint: Rid)
fn joint_clear(&mut self, joint: Rid)
Overridable version of joint_clear.
fn joint_set_param(&mut self, joint: Rid, param: JointParam, value: f32)
fn joint_set_param(&mut self, joint: Rid, param: JointParam, value: f32)
Overridable version of joint_set_param.
fn joint_get_param(&self, joint: Rid, param: JointParam) -> f32
fn joint_get_param(&self, joint: Rid, param: JointParam) -> f32
Overridable version of joint_get_param.
fn joint_disable_collisions_between_bodies(&mut self, joint: Rid, disable: bool)
fn joint_disable_collisions_between_bodies(&mut self, joint: Rid, disable: bool)
Overridable version of joint_disable_collisions_between_bodies.
fn joint_is_disabled_collisions_between_bodies(&self, joint: Rid) -> bool
fn joint_is_disabled_collisions_between_bodies(&self, joint: Rid) -> bool
Overridable version of joint_is_disabled_collisions_between_bodies.
fn joint_make_pin(
&mut self,
joint: Rid,
anchor: Vector2,
body_a: Rid,
body_b: Rid,
)
fn joint_make_pin( &mut self, joint: Rid, anchor: Vector2, body_a: Rid, body_b: Rid, )
Overridable version of joint_make_pin.
fn joint_make_groove(
&mut self,
joint: Rid,
a_groove1: Vector2,
a_groove2: Vector2,
b_anchor: Vector2,
body_a: Rid,
body_b: Rid,
)
fn joint_make_groove( &mut self, joint: Rid, a_groove1: Vector2, a_groove2: Vector2, b_anchor: Vector2, body_a: Rid, body_b: Rid, )
Overridable version of joint_make_groove.
fn joint_make_damped_spring(
&mut self,
joint: Rid,
anchor_a: Vector2,
anchor_b: Vector2,
body_a: Rid,
body_b: Rid,
)
fn joint_make_damped_spring( &mut self, joint: Rid, anchor_a: Vector2, anchor_b: Vector2, body_a: Rid, body_b: Rid, )
Overridable version of joint_make_damped_spring.
fn pin_joint_set_flag(&mut self, joint: Rid, flag: PinJointFlag, enabled: bool)
fn pin_joint_set_flag(&mut self, joint: Rid, flag: PinJointFlag, enabled: bool)
Overridable version of pin_joint_set_flag.
fn pin_joint_get_flag(&self, joint: Rid, flag: PinJointFlag) -> bool
fn pin_joint_get_flag(&self, joint: Rid, flag: PinJointFlag) -> bool
Overridable version of pin_joint_get_flag.
fn pin_joint_set_param(&mut self, joint: Rid, param: PinJointParam, value: f32)
fn pin_joint_set_param(&mut self, joint: Rid, param: PinJointParam, value: f32)
Overridable version of pin_joint_set_param.
fn pin_joint_get_param(&self, joint: Rid, param: PinJointParam) -> f32
fn pin_joint_get_param(&self, joint: Rid, param: PinJointParam) -> f32
Overridable version of pin_joint_get_param.
fn damped_spring_joint_set_param(
&mut self,
joint: Rid,
param: DampedSpringParam,
value: f32,
)
fn damped_spring_joint_set_param( &mut self, joint: Rid, param: DampedSpringParam, value: f32, )
Overridable version of damped_spring_joint_set_param.
fn damped_spring_joint_get_param(
&self,
joint: Rid,
param: DampedSpringParam,
) -> f32
fn damped_spring_joint_get_param( &self, joint: Rid, param: DampedSpringParam, ) -> f32
Overridable version of damped_spring_joint_get_param.
fn joint_get_type(&self, joint: Rid) -> JointType
fn joint_get_type(&self, joint: Rid) -> JointType
Overridable version of joint_get_type.
fn set_active(&mut self, active: bool)
fn set_active(&mut self, active: bool)
Overridable version of set_active.
fn init_ext(&mut self)
fn init_ext(&mut self)
Called when the main loop is initialized and creates a new instance of this physics server. See also initialize and finish.
Overridable version of PhysicsServer2D’s internal init method.
fn step(&mut self, step: f32)
fn step(&mut self, step: f32)
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 the value returned by get_physics_process_delta_time.
Overridable version of PhysicsServer2D’s internal step method.
fn sync(&mut self)
fn sync(&mut self)
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.
fn flush_queries(&mut self)
fn flush_queries(&mut self)
Called every physics step before step to process all remaining queries.
Overridable version of PhysicsServer2D’s internal flush_queries method.
fn end_sync(&mut self)
fn end_sync(&mut self)
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.
fn finish(&mut self)
fn finish(&mut self)
Called when the main loop finalizes to shut down the physics server. See also finalize and init_ext.
Overridable version of PhysicsServer2D’s internal finish method.
fn is_flushing_queries(&self) -> bool
fn is_flushing_queries(&self) -> 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.
fn get_process_info(&mut self, process_info: ProcessInfo) -> i32
fn get_process_info(&mut self, process_info: ProcessInfo) -> i32
Overridable version of get_process_info.
Provided Methods§
fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
Godot constructor, accepting an injected base object.
base refers to the base instance of the class, which can either be stored in a Base<T> field or discarded.
This method returns a fully-constructed instance, which will then be moved into a Gd<T> pointer.
If the class has a #[class(init)] attribute, this method will be auto-generated and must not be overridden.
fn on_notification(&mut self, what: ObjectNotification)
fn on_notification(&mut self, what: ObjectNotification)
Called when the object receives a Godot notification.
The type of notification can be identified through what. The enum is designed to hold all possible NOTIFICATION_*
constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown exists
to represent integers out of known constants (mistakes or future additions).
This method is named _notification in Godot, but on_notification in Rust. To send notifications, use the
Object::notify method.
See also in Godot docs:
fn on_get(&self, property: StringName) -> Option<Variant>
fn on_get(&self, property: StringName) -> Option<Variant>
Called whenever get() is called or Godot gets the value of a property.
Should return the given property’s value as Some(value), or None if the property should be handled normally.
See also in Godot docs:
fn on_set(&mut self, property: StringName, value: Variant) -> bool
fn on_set(&mut self, property: StringName, value: Variant) -> bool
Called whenever Godot set() is called or Godot sets the value of a property.
Should set property to the given value and return true, or return false to indicate the property
should be handled normally.
See also in Godot docs:
fn on_validate_property(&self, property: &mut PropertyInfo)
fn on_validate_property(&self, property: &mut PropertyInfo)
Called whenever Godot retrieves value of property. Allows to customize existing properties.
Every property info goes through this method, except properties added with on_get_property_list().
Exposed property here is a shared mutable reference obtained (and returned to) from Godot.
See also in the Godot docs:
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
Available on since_api=4.3 only.
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
since_api=4.3 only.Called whenever Godot get_property_list() is called, the returned vector here is
appended to the existing list of properties.
This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.
See also in Godot docs:
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
Called by Godot to tell if a property has a custom revert or not.
Return None for no custom revert, and return Some(value) to specify the custom revert.
This is a combination of Godot’s Object::_property_get_revert and Object::_property_can_revert. This means that this
function will usually be called twice by Godot to find the revert.
Note that this should be a pure function. That is, it should always return the same value for a property as long as self
remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.