Trait IPhysicsServer2DExtension
pub trait IPhysicsServer2DExtension: GodotClass<Base = PhysicsServer2DExtension> + You_forgot_the_attribute__godot_api {
Show 145 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(
&mut self,
shape_A: Rid,
xform_A: Transform2D,
motion_A: Vector2,
shape_B: Rid,
xform_B: Transform2D,
motion_B: Vector2,
results: *mut c_void,
result_max: i32,
result_count: *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) -> PackedVector2Array;
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(
&mut self,
body: Rid,
body_shape: i32,
shape: Rid,
shape_xform: Transform2D,
motion: Vector2,
results: *mut c_void,
result_max: i32,
result_count: *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(
&self,
body: Rid,
from: Transform2D,
motion: Vector2,
margin: f32,
collide_separation_ray: bool,
recovery_as_collision: bool,
result: *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 to_string(&self) -> GString { ... }
fn on_notification(&mut self, what: ObjectNotification) { ... }
fn get_property(&self, property: StringName) -> Option<Variant> { ... }
fn set_property(&mut self, property: StringName, value: Variant) -> bool { ... }
fn get_property_list(&mut self) -> Vec<PropertyInfo> { ... }
fn property_get_revert(&self, property: StringName) -> Option<Variant> { ... }
}
Expand description
Virtual methods for class PhysicsServer2DExtension
.
These methods represent constructors (init
) or callbacks invoked by the engine.
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(
&mut self,
shape_A: Rid,
xform_A: Transform2D,
motion_A: Vector2,
shape_B: Rid,
xform_B: Transform2D,
motion_B: Vector2,
results: *mut c_void,
result_max: i32,
result_count: *mut i32,
) -> bool
unsafe fn shape_collide( &mut self, shape_A: Rid, xform_A: Transform2D, motion_A: Vector2, shape_B: Rid, xform_B: Transform2D, motion_B: Vector2, results: *mut c_void, result_max: i32, result_count: *mut i32, ) -> bool
§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_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) -> PackedVector2Array
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(
&mut self,
body: Rid,
body_shape: i32,
shape: Rid,
shape_xform: Transform2D,
motion: Vector2,
results: *mut c_void,
result_max: i32,
result_count: *mut i32,
) -> bool
unsafe fn body_collide_shape( &mut self, body: Rid, body_shape: i32, shape: Rid, shape_xform: Transform2D, motion: Vector2, results: *mut c_void, result_max: i32, result_count: *mut i32, ) -> bool
§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_get_direct_state( &mut self, body: Rid, ) -> Option<Gd<PhysicsDirectBodyState2D>>
unsafe fn body_test_motion(
&self,
body: Rid,
from: Transform2D,
motion: Vector2,
margin: f32,
collide_separation_ray: bool,
recovery_as_collision: bool,
result: *mut PhysicsServer2DExtensionMotionResult,
) -> bool
unsafe fn body_test_motion( &self, body: Rid, from: Transform2D, motion: Vector2, margin: f32, collide_separation_ray: bool, recovery_as_collision: bool, result: *mut PhysicsServer2DExtensionMotionResult, ) -> bool
§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_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 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 to_string(&self) -> GString
fn to_string(&self) -> GString
String representation of the Godot instance.
Override this method to define how the instance is represented as a string.
Used by impl Display for Gd<T>
, as well as str()
and print()
in GDScript.
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 get_property(&self, property: StringName) -> Option<Variant>
fn get_property(&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 set_property(&mut self, property: StringName, value: Variant) -> bool
fn set_property(&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 get_property_list(&mut self) -> Vec<PropertyInfo>
Available on since_api="4.3"
only.
fn 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 property_get_revert(&self, property: StringName) -> Option<Variant>
fn 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.