Skip to main content

PhysicsServer3DExtension

Struct PhysicsServer3DExtension 

pub struct PhysicsServer3DExtension { /* private fields */ }
Expand description

Godot class PhysicsServer3DExtension.

Inherits PhysicsServer3D.

Related symbols:

See also Godot docs for PhysicsServer3DExtension.

§Construction

This class is manually managed. You can create a new instance using PhysicsServer3DExtension::new_alloc().

Do not forget to call free() or hand over ownership to Godot.

§Godot docs

This class extends PhysicsServer3D 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 PhysicsServer3D.

Implementations§

Methods from Deref<Target = PhysicsServer3D>§

pub fn world_boundary_shape_create(&mut self) -> Rid

Creates a 3D world boundary shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the shape’s normal direction and distance properties.

pub fn separation_ray_shape_create(&mut self) -> Rid

Creates a 3D separation ray shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the shape’s length and slide_on_slope properties.

pub fn sphere_shape_create(&mut self) -> Rid

Creates a 3D sphere shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the sphere’s radius.

pub fn box_shape_create(&mut self) -> Rid

Creates a 3D box shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the box’s half-extents.

pub fn capsule_shape_create(&mut self) -> Rid

Creates a 3D capsule shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the capsule’s height and radius.

pub fn cylinder_shape_create(&mut self) -> Rid

Creates a 3D cylinder shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the cylinder’s height and radius.

pub fn convex_polygon_shape_create(&mut self) -> Rid

Creates a 3D convex polygon shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the convex polygon’s points.

pub fn concave_polygon_shape_create(&mut self) -> Rid

Creates a 3D concave polygon shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the concave polygon’s triangles.

pub fn heightmap_shape_create(&mut self) -> Rid

Creates a 3D heightmap shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the heightmap’s data.

pub fn custom_shape_create(&mut self) -> Rid

Creates a custom shape in the physics server, and returns the RID that identifies it. Use shape_set_data to set the shape’s data.

Note: Custom shapes are not supported by the built-in physics servers, so calling this method always produces an error when using Godot Physics or Jolt Physics. Custom physics servers implemented as GDExtensions may support a custom shape.

pub fn shape_set_data(&mut self, shape: Rid, data: &Variant)

Sets the shape data that configures the shape. The data to be passed depends on the shape’s type (see shape_get_type):

pub fn shape_set_margin(&mut self, shape: Rid, margin: f32)

Sets the collision margin for the shape.

Note: This is not used in Godot Physics.

pub fn shape_get_type(&self, shape: Rid) -> ShapeType

Returns the shape’s type.

pub fn shape_get_data(&self, shape: Rid) -> Variant

Returns the shape data that configures the shape, such as the half-extents of a box or the triangles of a concave (trimesh) shape. See shape_set_data for the precise format of this data in each case.

pub fn shape_get_margin(&self, shape: Rid) -> f32

Returns the collision margin for the shape.

Note: This is not used in Godot Physics, so will always return 0.

pub fn space_create(&mut self) -> Rid

Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with area_set_space, or to a body with body_set_space.

pub fn space_set_active(&mut self, space: Rid, active: bool)

Marks a space as active. It will not have an effect, unless it is assigned to an area or body.

pub fn space_is_active(&self, space: Rid) -> bool

Returns whether the space is active.

pub fn space_set_param(&mut self, space: Rid, param: SpaceParameter, value: f32)

Sets the value for a space parameter. A list of available parameters is on the [enum SpaceParameter] constants.

pub fn space_get_param(&self, space: Rid, param: SpaceParameter) -> f32

Returns the value of a space parameter.

pub fn space_get_direct_state( &mut self, space: Rid, ) -> Option<Gd<PhysicsDirectSpaceState3D>>

Returns the state of a space, a PhysicsDirectSpaceState3D. This object can be used to make collision/intersection queries.

pub fn area_create(&mut self) -> Rid

Creates a 3D 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 1, and monitorable set to false.

Use area_add_shape to add shapes to it, use area_set_transform to set its transform, and use area_set_space to add the area to a space. If you want the area to be detectable use area_set_monitorable.

pub fn area_set_space(&mut self, area: Rid, space: Rid)

Assigns a space to the area.

pub fn area_get_space(&self, area: Rid) -> Rid

Returns the space assigned to the area.

pub fn area_add_shape(&mut self, area: Rid, shape: Rid)

To set the default parameters, use area_add_shape_ex and its builder methods. See the book for detailed usage instructions. Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

pub fn area_add_shape_ex<'ex>( &'ex mut self, area: Rid, shape: Rid, ) -> ExAreaAddShape<'ex>

Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

pub fn area_set_shape(&mut self, area: Rid, shape_idx: i32, shape: Rid)

Substitutes a given area shape by another. The old shape is selected by its index, the new one by its RID.

pub fn area_set_shape_transform( &mut self, area: Rid, shape_idx: i32, transform: Transform3D, )

Sets the transform matrix for an area shape.

pub fn area_set_shape_disabled( &mut self, area: Rid, shape_idx: i32, disabled: bool, )

pub fn area_get_shape_count(&self, area: Rid) -> i32

Returns the number of shapes assigned to an area.

pub fn area_get_shape(&self, area: Rid, shape_idx: i32) -> Rid

Returns the RID of the nth shape of an area.

pub fn area_get_shape_transform(&self, area: Rid, shape_idx: i32) -> Transform3D

Returns the transform matrix of a shape within an area.

pub fn area_remove_shape(&mut self, area: Rid, shape_idx: i32)

Removes a shape from an area. It does not delete the shape, so it can be reassigned later.

pub fn area_clear_shapes(&mut self, area: Rid)

Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later.

pub fn area_set_collision_layer(&mut self, area: Rid, layer: u32)

Assigns the area to one or many physics layers.

pub fn area_get_collision_layer(&self, area: Rid) -> u32

Returns the physics layer or layers an area belongs to.

pub fn area_set_collision_mask(&mut self, area: Rid, mask: u32)

Sets which physics layers the area will monitor.

pub fn area_get_collision_mask(&self, area: Rid) -> u32

Returns the physics layer or layers an area can contact with.

pub fn area_set_param( &mut self, area: Rid, param: AreaParameter, value: &Variant, )

Sets the value for an area parameter. A list of available parameters is on the [enum AreaParameter] constants.

pub fn area_set_transform(&mut self, area: Rid, transform: Transform3D)

Sets the transform matrix for an area.

pub fn area_get_param(&self, area: Rid, param: AreaParameter) -> Variant

Returns an area parameter value. A list of available parameters is on the [enum AreaParameter] constants.

pub fn area_get_transform(&self, area: Rid) -> Transform3D

Returns the transform matrix for an area.

pub fn area_attach_object_instance_id(&mut self, area: Rid, id: u64)

Assigns the area to a descendant of Object, so it can exist in the node tree.

pub fn area_get_object_instance_id(&self, area: Rid) -> u64

Gets the instance ID of the object the area is assigned to.

pub fn area_set_monitor_callback(&mut self, area: Rid, callback: &Callable)

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 status: either AreaBodyStatus::ADDED or AreaBodyStatus::REMOVED depending on whether the other body shape entered or exited the area,

  2. an RID body_rid: the RID of the body that entered or exited the area,

  3. an integer instance_id: the ObjectID attached to the body,

  4. an integer body_shape_idx: the index of the shape of the body that entered or exited the area,

  5. an integer self_shape_idx: 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.

pub fn area_set_area_monitor_callback(&mut self, area: Rid, callback: &Callable)

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 status: either AreaBodyStatus::ADDED or AreaBodyStatus::REMOVED depending on whether the other area’s shape entered or exited the area,

  2. an RID area_rid: the RID of the other area that entered or exited the area,

  3. an integer instance_id: the ObjectID attached to the other area,

  4. an integer area_shape_idx: the index of the shape of the other area that entered or exited the area,

  5. an integer self_shape_idx: 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.

pub fn area_set_monitorable(&mut self, area: Rid, monitorable: bool)

pub fn area_set_ray_pickable(&mut self, area: Rid, enable: bool)

Sets object pickable with rays.

pub fn body_create(&mut self) -> Rid

Creates a 3D 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 1, and body mode set to BodyMode::RIGID.

Use body_add_shape to add shapes to it, use body_set_state to set its transform, and use body_set_space to add the body to a space.

pub fn body_set_space(&mut self, body: Rid, space: Rid)

Assigns a space to the body (see space_create).

pub fn body_get_space(&self, body: Rid) -> Rid

Returns the RID of the space assigned to a body.

pub fn body_set_mode(&mut self, body: Rid, mode: BodyMode)

Sets the body mode.

pub fn body_get_mode(&self, body: Rid) -> BodyMode

Returns the body mode.

pub fn body_set_collision_layer(&mut self, body: Rid, layer: u32)

Sets the physics layer or layers a body belongs to.

pub fn body_get_collision_layer(&self, body: Rid) -> u32

Returns the physics layer or layers a body belongs to.

pub fn body_set_collision_mask(&mut self, body: Rid, mask: u32)

Sets the physics layer or layers a body can collide with.

pub fn body_get_collision_mask(&self, body: Rid) -> u32

Returns the physics layer or layers a body can collide with.

pub fn body_set_collision_priority(&mut self, body: Rid, priority: f32)

Sets the body’s collision priority.

pub fn body_get_collision_priority(&self, body: Rid) -> f32

Returns the body’s collision priority.

pub fn body_add_shape(&mut self, body: Rid, shape: Rid)

To set the default parameters, use body_add_shape_ex and its builder methods. See the book for detailed usage instructions. Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

pub fn body_add_shape_ex<'ex>( &'ex mut self, body: Rid, shape: Rid, ) -> ExBodyAddShape<'ex>

Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.

pub fn body_set_shape(&mut self, body: Rid, shape_idx: i32, shape: Rid)

Substitutes a given body shape by another. The old shape is selected by its index, the new one by its RID.

pub fn body_set_shape_transform( &mut self, body: Rid, shape_idx: i32, transform: Transform3D, )

Sets the transform matrix for a body shape.

pub fn body_set_shape_disabled( &mut self, body: Rid, shape_idx: i32, disabled: bool, )

pub fn body_get_shape_count(&self, body: Rid) -> i32

Returns the number of shapes assigned to a body.

pub fn body_get_shape(&self, body: Rid, shape_idx: i32) -> Rid

Returns the RID of the nth shape of a body.

pub fn body_get_shape_transform(&self, body: Rid, shape_idx: i32) -> Transform3D

Returns the transform matrix of a body shape.

pub fn body_remove_shape(&mut self, body: Rid, shape_idx: i32)

Removes a shape from a body. The shape is not deleted, so it can be reused afterwards.

pub fn body_clear_shapes(&mut self, body: Rid)

Removes all shapes from a body.

pub fn body_attach_object_instance_id(&mut self, body: Rid, id: u64)

Assigns the area to a descendant of Object, so it can exist in the node tree.

pub fn body_get_object_instance_id(&self, body: Rid) -> u64

Gets the instance ID of the object the area is assigned to.

pub fn body_set_enable_continuous_collision_detection( &mut self, body: Rid, enable: bool, )

If true, the continuous collision detection mode is enabled.

Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.

pub fn body_is_continuous_collision_detection_enabled(&self, body: Rid) -> bool

If true, the continuous collision detection mode is enabled.

pub fn body_set_param( &mut self, body: Rid, param: BodyParameter, value: &Variant, )

Sets a body parameter. A list of available parameters is on the [enum BodyParameter] constants.

pub fn body_get_param(&self, body: Rid, param: BodyParameter) -> Variant

Returns the value of a body parameter. A list of available parameters is on the [enum BodyParameter] constants.

pub fn body_reset_mass_properties(&mut self, body: Rid)

Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using body_set_param.

pub fn body_set_state(&mut self, body: Rid, state: BodyState, value: &Variant)

Sets a body state.

pub fn body_get_state(&self, body: Rid, state: BodyState) -> Variant

Returns a body state.

pub fn body_apply_central_impulse(&mut self, body: Rid, impulse: Vector3)

Applies a directional impulse without affecting 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 body_apply_impulse at the body’s center of mass.

pub fn body_apply_impulse(&mut self, body: Rid, impulse: Vector3)

To set the default parameters, use body_apply_impulse_ex and its builder methods. See the book for detailed usage instructions. Applies a positioned impulse to the body.

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).

position is the offset from the body origin in global coordinates.

pub fn body_apply_impulse_ex<'ex>( &'ex mut self, body: Rid, impulse: Vector3, ) -> ExBodyApplyImpulse<'ex>

Applies a positioned impulse to the body.

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).

position is the offset from the body origin in global coordinates.

pub fn body_apply_torque_impulse(&mut self, body: Rid, impulse: Vector3)

Applies a rotational impulse to the body without affecting the 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).

pub fn body_apply_central_force(&mut self, body: Rid, force: Vector3)

Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update.

This is equivalent to using body_apply_force at the body’s center of mass.

pub fn body_apply_force(&mut self, body: Rid, force: Vector3)

To set the default parameters, use body_apply_force_ex and its builder methods. See the book for detailed usage instructions. Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.

position is the offset from the body origin in global coordinates.

pub fn body_apply_force_ex<'ex>( &'ex mut self, body: Rid, force: Vector3, ) -> ExBodyApplyForce<'ex>

Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.

position is the offset from the body origin in global coordinates.

pub fn body_apply_torque(&mut self, body: Rid, torque: Vector3)

Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.

pub fn body_add_constant_central_force(&mut self, body: Rid, force: Vector3)

Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

This is equivalent to using body_add_constant_force at the body’s center of mass.

pub fn body_add_constant_force(&mut self, body: Rid, force: Vector3)

To set the default parameters, use body_add_constant_force_ex and its builder methods. See the book for detailed usage instructions. Adds a constant positioned force to the body that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

position is the offset from the body origin in global coordinates.

pub fn body_add_constant_force_ex<'ex>( &'ex mut self, body: Rid, force: Vector3, ) -> ExBodyAddConstantForce<'ex>

Adds a constant positioned force to the body that keeps being applied over time until cleared with body_set_constant_force(body, Vector3(0, 0, 0)).

position is the offset from the body origin in global coordinates.

pub fn body_add_constant_torque(&mut self, body: Rid, torque: Vector3)

Adds a constant rotational force without affecting position that keeps being applied over time until cleared with body_set_constant_torque(body, Vector3(0, 0, 0)).

pub fn body_set_constant_force(&mut self, body: Rid, force: Vector3)

Sets the body’s total constant positional forces applied during each physics update.

See body_add_constant_force and body_add_constant_central_force.

pub fn body_get_constant_force(&self, body: Rid) -> Vector3

Returns the body’s total constant positional forces applied during each physics update.

See body_add_constant_force and body_add_constant_central_force.

pub fn body_set_constant_torque(&mut self, body: Rid, torque: Vector3)

Sets the body’s total constant rotational forces applied during each physics update.

See body_add_constant_torque.

pub fn body_get_constant_torque(&self, body: Rid) -> Vector3

Returns the body’s total constant rotational forces applied during each physics update.

See body_add_constant_torque.

pub fn body_set_axis_velocity(&mut self, body: Rid, axis_velocity: Vector3)

Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.

pub fn body_set_axis_lock(&mut self, body: Rid, axis: BodyAxis, lock: bool)

pub fn body_is_axis_locked(&self, body: Rid, axis: BodyAxis) -> bool

pub fn body_add_collision_exception(&mut self, body: Rid, excepted_body: Rid)

Adds a body to the list of bodies exempt from collisions.

pub fn body_remove_collision_exception(&mut self, body: Rid, excepted_body: Rid)

Removes a body from the list of bodies exempt from collisions.

Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided.

pub fn body_set_max_contacts_reported(&mut self, body: Rid, amount: i32)

Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies. This is enabled by setting the maximum number of contacts reported to a number greater than 0.

pub fn body_get_max_contacts_reported(&self, body: Rid) -> i32

Returns the maximum contacts that can be reported. See body_set_max_contacts_reported.

pub fn body_set_omit_force_integration(&mut self, body: Rid, enable: bool)

Sets whether the body omits the standard force integration. If enable is true, the body will not automatically use applied forces, torques, and damping to update the body’s linear and angular velocity. In this case, 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 RigidBody3D.custom_integrator] is set.

pub fn body_is_omitting_force_integration(&self, body: Rid) -> bool

Returns true if the body is omitting the standard force integration. See body_set_omit_force_integration.

pub fn body_set_state_sync_callback(&mut self, body: Rid, callable: &Callable)

Sets the body’s state synchronization callback function to callable. Use an empty Callable (Callable()) to clear the callback.

The function 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 callable must take the following parameters:

  1. state: a PhysicsDirectBodyState3D, used to retrieve the body’s state.

pub fn body_set_force_integration_callback( &mut self, body: Rid, callable: &Callable, )

To set the default parameters, use body_set_force_integration_callback_ex and its builder methods. See the book for detailed usage instructions. Sets the body’s custom force integration callback function to callable. Use an empty Callable (Callable()) to clear the custom callback.

The function callable will be called every physics tick, before the standard force integration (see 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 userdata is not null, the function callable must take the following two parameters:

  1. state: a PhysicsDirectBodyState3D, used to retrieve and modify the body’s state,

  2. userdata: a Variant; its value will be the userdata passed into this method.

If userdata is null, then callable must take only the state parameter.

pub fn body_set_force_integration_callback_ex<'ex>( &'ex mut self, body: Rid, callable: &'ex Callable, ) -> ExBodySetForceIntegrationCallback<'ex>

Sets the body’s custom force integration callback function to callable. Use an empty Callable (Callable()) to clear the custom callback.

The function callable will be called every physics tick, before the standard force integration (see 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 userdata is not null, the function callable must take the following two parameters:

  1. state: a PhysicsDirectBodyState3D, used to retrieve and modify the body’s state,

  2. userdata: a Variant; its value will be the userdata passed into this method.

If userdata is null, then callable must take only the state parameter.

pub fn body_set_ray_pickable(&mut self, body: Rid, enable: bool)

Sets the body pickable with rays if enable is set.

pub fn body_test_motion( &mut self, body: Rid, parameters: impl AsArg<Gd<PhysicsTestMotionParameters3D>>, ) -> bool

To set the default parameters, use body_test_motion_ex and its builder methods. See the book for detailed usage instructions. Returns true if a collision would result from moving along a motion vector from a given point in space. PhysicsTestMotionParameters3D is passed to set motion parameters. PhysicsTestMotionResult3D can be passed to return additional information.

pub fn body_test_motion_ex<'ex>( &'ex mut self, body: Rid, parameters: impl AsArg<Gd<PhysicsTestMotionParameters3D>> + 'ex, ) -> ExBodyTestMotion<'ex>

Returns true if a collision would result from moving along a motion vector from a given point in space. PhysicsTestMotionParameters3D is passed to set motion parameters. PhysicsTestMotionResult3D can be passed to return additional information.

pub fn body_get_direct_state( &mut self, body: Rid, ) -> Option<Gd<PhysicsDirectBodyState3D>>

Returns the PhysicsDirectBodyState3D of the body. Returns null if the body is destroyed or removed from the physics space.

pub fn soft_body_create(&mut self) -> Rid

Creates a new soft body and returns its internal RID.

pub fn soft_body_update_rendering_server( &mut self, body: Rid, rendering_server_handler: impl AsArg<Gd<PhysicsServer3DRenderingServerHandler>>, )

Requests that the physics server updates the rendering server with the latest positions of the given soft body’s points through the rendering_server_handler interface.

pub fn soft_body_set_space(&mut self, body: Rid, space: Rid)

Assigns a space to the given soft body (see space_create).

pub fn soft_body_get_space(&self, body: Rid) -> Rid

Returns the RID of the space assigned to the given soft body.

pub fn soft_body_set_mesh(&mut self, body: Rid, mesh: Rid)

Sets the mesh of the given soft body.

pub fn soft_body_get_bounds(&self, body: Rid) -> Aabb

Returns the bounds of the given soft body in global coordinates.

pub fn soft_body_set_collision_layer(&mut self, body: Rid, layer: u32)

Sets the physics layer or layers the given soft body belongs to.

pub fn soft_body_get_collision_layer(&self, body: Rid) -> u32

Returns the physics layer or layers that the given soft body belongs to.

pub fn soft_body_set_collision_mask(&mut self, body: Rid, mask: u32)

Sets the physics layer or layers the given soft body can collide with.

pub fn soft_body_get_collision_mask(&self, body: Rid) -> u32

Returns the physics layer or layers that the given soft body can collide with.

pub fn soft_body_add_collision_exception(&mut self, body: Rid, body_b: Rid)

Adds the given body to the list of bodies exempt from collisions.

pub fn soft_body_remove_collision_exception(&mut self, body: Rid, body_b: Rid)

Removes the given body from the list of bodies exempt from collisions.

pub fn soft_body_set_state( &mut self, body: Rid, state: BodyState, variant: &Variant, )

Sets the given body state for the given body.

Note: Godot’s default physics implementation does not support BodyState::LINEAR_VELOCITY, BodyState::ANGULAR_VELOCITY, BodyState::SLEEPING, or BodyState::CAN_SLEEP.

pub fn soft_body_get_state(&self, body: Rid, state: BodyState) -> Variant

Returns the given soft body state.

Note: Godot’s default physics implementation does not support BodyState::LINEAR_VELOCITY, BodyState::ANGULAR_VELOCITY, BodyState::SLEEPING, or BodyState::CAN_SLEEP.

pub fn soft_body_set_transform(&mut self, body: Rid, transform: Transform3D)

Sets the global transform of the given soft body.

pub fn soft_body_set_ray_pickable(&mut self, body: Rid, enable: bool)

Sets whether the given soft body will be pickable when using object picking.

pub fn soft_body_set_simulation_precision( &mut self, body: Rid, simulation_precision: i32, )

Sets the simulation precision of the given soft body. Increasing this value will improve the resulting simulation, but can affect performance. Use with care.

pub fn soft_body_get_simulation_precision(&self, body: Rid) -> i32

Returns the simulation precision of the given soft body.

pub fn soft_body_set_total_mass(&mut self, body: Rid, total_mass: f32)

Sets the total mass for the given soft body.

pub fn soft_body_get_total_mass(&self, body: Rid) -> f32

Returns the total mass assigned to the given soft body.

pub fn soft_body_set_linear_stiffness(&mut self, body: Rid, stiffness: f32)

Sets the linear stiffness of the given soft body. Higher values will result in a stiffer body, while lower values will increase the body’s ability to bend. The value can be between 0.0 and 1.0 (inclusive).

pub fn soft_body_get_linear_stiffness(&self, body: Rid) -> f32

Returns the linear stiffness of the given soft body.

pub fn soft_body_set_shrinking_factor( &mut self, body: Rid, shrinking_factor: f32, )

Sets the shrinking factor of the given soft body.

pub fn soft_body_get_shrinking_factor(&self, body: Rid) -> f32

Returns the shrinking factor of the given soft body.

pub fn soft_body_set_pressure_coefficient( &mut self, body: Rid, pressure_coefficient: f32, )

Sets the pressure coefficient of the given soft body. Simulates pressure build-up from inside this body. Higher values increase the strength of this effect.

pub fn soft_body_get_pressure_coefficient(&self, body: Rid) -> f32

Returns the pressure coefficient of the given soft body.

pub fn soft_body_set_damping_coefficient( &mut self, body: Rid, damping_coefficient: f32, )

Sets the damping coefficient of the given soft body. Higher values will slow down the body more noticeably when forces are applied.

pub fn soft_body_get_damping_coefficient(&self, body: Rid) -> f32

Returns the damping coefficient of the given soft body.

pub fn soft_body_set_drag_coefficient( &mut self, body: Rid, drag_coefficient: f32, )

Sets the drag coefficient of the given soft body. Higher values increase this body’s air resistance.

Note: This value is currently unused by Godot’s default physics implementation.

pub fn soft_body_get_drag_coefficient(&self, body: Rid) -> f32

Returns the drag coefficient of the given soft body.

pub fn soft_body_move_point( &mut self, body: Rid, point_index: i32, global_position: Vector3, )

Moves the given soft body point to a position in global coordinates.

pub fn soft_body_get_point_global_position( &self, body: Rid, point_index: i32, ) -> Vector3

Returns the current position of the given soft body point in global coordinates.

pub fn soft_body_remove_all_pinned_points(&mut self, body: Rid)

Unpins all points of the given soft body.

pub fn soft_body_pin_point(&mut self, body: Rid, point_index: i32, pin: bool)

Pins or unpins the given soft body point based on the value of pin.

Note: Pinning a point effectively makes it kinematic, preventing it from being affected by forces, but you can still move it using soft_body_move_point.

pub fn soft_body_is_point_pinned(&self, body: Rid, point_index: i32) -> bool

Returns whether the given soft body point is pinned.

pub fn soft_body_apply_point_impulse( &mut self, body: Rid, point_index: i32, impulse: Vector3, )

Applies an impulse to a point.

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).

pub fn soft_body_apply_point_force( &mut self, body: Rid, point_index: i32, force: Vector3, )

Applies a force to a point. A force is time dependent and meant to be applied every physics update.

pub fn soft_body_apply_central_impulse(&mut self, body: Rid, impulse: Vector3)

Distributes and applies an impulse to all points.

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).

pub fn soft_body_apply_central_force(&mut self, body: Rid, force: Vector3)

Distributes and applies a force to all points. A force is time dependent and meant to be applied every physics update.

pub fn joint_create(&mut self) -> Rid

pub fn joint_clear(&mut self, joint: Rid)

pub fn joint_make_pin( &mut self, joint: Rid, body_A: Rid, local_A: Vector3, body_B: Rid, local_B: Vector3, )

pub fn pin_joint_set_param( &mut self, joint: Rid, param: PinJointParam, value: f32, )

Sets a pin joint parameter.

pub fn pin_joint_get_param(&self, joint: Rid, param: PinJointParam) -> f32

Gets a pin joint parameter.

pub fn pin_joint_set_local_a(&mut self, joint: Rid, local_A: Vector3)

Sets position of the joint in the local space of body a of the joint.

pub fn pin_joint_get_local_a(&self, joint: Rid) -> Vector3

Returns position of the joint in the local space of body a of the joint.

pub fn pin_joint_set_local_b(&mut self, joint: Rid, local_B: Vector3)

Sets position of the joint in the local space of body b of the joint.

pub fn pin_joint_get_local_b(&self, joint: Rid) -> Vector3

Returns position of the joint in the local space of body b of the joint.

pub fn joint_make_hinge( &mut self, joint: Rid, body_A: Rid, hinge_A: Transform3D, body_B: Rid, hinge_B: Transform3D, )

pub fn hinge_joint_set_param( &mut self, joint: Rid, param: HingeJointParam, value: f32, )

Sets a hinge joint parameter.

pub fn hinge_joint_get_param(&self, joint: Rid, param: HingeJointParam) -> f32

Gets a hinge joint parameter.

pub fn hinge_joint_set_flag( &mut self, joint: Rid, flag: HingeJointFlag, enabled: bool, )

Sets a hinge joint flag.

pub fn hinge_joint_get_flag(&self, joint: Rid, flag: HingeJointFlag) -> bool

Gets a hinge joint flag.

pub fn joint_make_slider( &mut self, joint: Rid, body_A: Rid, local_ref_A: Transform3D, body_B: Rid, local_ref_B: Transform3D, )

pub fn slider_joint_set_param( &mut self, joint: Rid, param: SliderJointParam, value: f32, )

Gets a slider joint parameter.

pub fn slider_joint_get_param(&self, joint: Rid, param: SliderJointParam) -> f32

Gets a slider joint parameter.

pub fn joint_make_cone_twist( &mut self, joint: Rid, body_A: Rid, local_ref_A: Transform3D, body_B: Rid, local_ref_B: Transform3D, )

pub fn cone_twist_joint_set_param( &mut self, joint: Rid, param: ConeTwistJointParam, value: f32, )

Sets a cone twist joint parameter.

pub fn cone_twist_joint_get_param( &self, joint: Rid, param: ConeTwistJointParam, ) -> f32

Gets a cone twist joint parameter.

pub fn joint_get_type(&self, joint: Rid) -> JointType

Returns the type of the Joint3D.

pub fn joint_set_solver_priority(&mut self, joint: Rid, priority: i32)

Sets the priority value of the Joint3D.

pub fn joint_get_solver_priority(&self, joint: Rid) -> i32

Gets the priority value of the Joint3D.

pub fn joint_disable_collisions_between_bodies( &mut self, joint: Rid, disable: bool, )

Sets whether the bodies attached to the Joint3D will collide with each other.

pub fn joint_is_disabled_collisions_between_bodies(&self, joint: Rid) -> bool

Returns whether the bodies attached to the Joint3D will collide with each other.

pub fn joint_make_generic_6dof( &mut self, joint: Rid, body_A: Rid, local_ref_A: Transform3D, body_B: Rid, local_ref_B: Transform3D, )

Make the joint a generic six degrees of freedom (6DOF) joint. Use generic_6dof_joint_set_flag and generic_6dof_joint_set_param to set the joint’s flags and parameters respectively.

pub fn generic_6dof_joint_set_param( &mut self, joint: Rid, axis: Vector3Axis, param: G6dofJointAxisParam, value: f32, )

Sets the value of a given generic 6DOF joint parameter.

pub fn generic_6dof_joint_get_param( &self, joint: Rid, axis: Vector3Axis, param: G6dofJointAxisParam, ) -> f32

Returns the value of a generic 6DOF joint parameter.

pub fn generic_6dof_joint_set_flag( &mut self, joint: Rid, axis: Vector3Axis, flag: G6dofJointAxisFlag, enable: bool, )

Sets the value of a given generic 6DOF joint flag.

pub fn generic_6dof_joint_get_flag( &self, joint: Rid, axis: Vector3Axis, flag: G6dofJointAxisFlag, ) -> bool

Returns the value of a generic 6DOF joint flag.

pub fn free_rid(&mut self, rid: Rid)

Destroys any of the objects created by PhysicsServer3D. If the RID passed is not one of the objects that can be created by PhysicsServer3D, an error will be sent to the console.

pub fn set_active(&mut self, active: bool)

Activates or deactivates the 3D physics engine.

pub fn get_process_info(&self, process_info: ProcessInfo) -> i32

Returns the value of a physics engine state specified by process_info.

Methods from Deref<Target = Object>§

pub fn get_script(&self) -> Option<Gd<Script>>

pub fn set_script(&mut self, script: impl AsArg<Option<Gd<Script>>>)

pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error

pub fn connect_flags( &mut self, signal: impl AsArg<StringName>, callable: &Callable, flags: ConnectFlags, ) -> Error

pub fn get_class(&self) -> GString

Returns the object’s built-in class name, as a String. See also is_class.

Note: This method ignores class_name declarations. If this object’s script has defined a class_name, the base, built-in class name is returned instead.

pub fn is_class(&self, class: impl AsArg<GString>) -> bool

Returns true if the object inherits from the given class. See also get_class.

var sprite2d = Sprite2D.new()
sprite2d.is_class("Sprite2D") # Returns true
sprite2d.is_class("Node")     # Returns true
sprite2d.is_class("Node3D")   # Returns false

Note: This method ignores class_name declarations in the object’s script.

pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)

Assigns value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing happens.

var node = Node2D.new()
node.set("global_scale", Vector2(8, 2.5))
print(node.global_scale) # Prints (8.0, 2.5)

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get(&self, property: impl AsArg<StringName>) -> Variant

Returns the Variant value of the given property. If the property does not exist, this method returns null.

var node = Node2D.new()
node.rotation = 1.5
var a = node.get("rotation") # a is 1.5

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )

Assigns a new value to the property identified by the property_path. The path should be a NodePath relative to this object, and can use the colon character (:) to access nested properties.

var node = Node2D.new()
node.set_indexed("position", Vector2(42, 0))
node.set_indexed("position:y", -10)
print(node.position) # Prints (42.0, -10.0)

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant

Gets the object’s property indexed by the given property_path. The path should be a NodePath relative to the current object and can use the colon character (:) to access nested properties.

Examples: "position:x" or "material:next_pass:blend_mode".

var node = Node2D.new()
node.position = Vector2(5, -10)
var a = node.get_indexed("position")   # a is Vector2(5, -10)
var b = node.get_indexed("position:y") # b is -10

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

Note: This method does not support actual paths to nodes in the SceneTree, only sub-property paths. In the context of nodes, use get_node_and_resource instead.

pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the object’s property list as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the property’s name, as a String;

  • class_name is an empty StringName, unless the property is VariantType::OBJECT and it inherits from a class;

  • type is the property’s type, as an int (see [enum Variant.Type]);

  • hint is how the property is meant to be edited (see [enum PropertyHint]);

  • hint_string depends on the hint (see [enum PropertyHint]);

  • usage is a combination of [enum PropertyUsageFlags].

Note: In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.

pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns this object’s methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the name of the method, as a String;

  • args is an Array of dictionaries representing the arguments;

  • default_args is the default arguments as an Array of variants;

  • flags is a combination of [enum MethodFlags];

  • id is the method’s internal identifier int;

  • return is the returned value, as a Dictionary;

Note: The dictionaries of args and return are formatted identically to the results of get_property_list, although not all entries are used.

pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool

Returns true if the given property has a custom default value. Use property_get_revert to get the property’s default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns false.

pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant

Returns the custom default value of the given property. Use property_can_revert to check if the property has a custom default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns null.

pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)

Adds or changes the entry name inside the object’s metadata. The metadata value can be any Variant, although some types cannot be serialized correctly.

If value is null, the entry is removed. This is the equivalent of using remove_meta. See also has_meta and get_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn remove_meta(&mut self, name: impl AsArg<StringName>)

Removes the given entry name from the object’s metadata. See also has_meta, get_meta and set_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant

To set the default parameters, use get_meta_ex and its builder methods. See the book for detailed usage instructions. Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetMeta<'ex>

Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool

Returns true if a metadata entry is found with the given name. See also get_meta, set_meta and remove_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_list(&self) -> Array<StringName>

Returns the object’s metadata entry names as an Array of StringNames.

pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)

To set the default parameters, use add_user_signal_ex and its builder methods. See the book for detailed usage instructions. Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn add_user_signal_ex<'ex>( &'ex mut self, signal: impl AsArg<GString> + 'ex, ) -> ExAddUserSignal<'ex>

Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given user-defined signal name exists. Only signals added with add_user_signal are included. See also remove_user_signal.

pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)

Removes the given user signal signal from the object. See also add_user_signal and has_user_signal.

pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Emits the given signal by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see add_user_signal). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

Returns Error::ERR_UNAVAILABLE if signal does not exist or the parameters are invalid.

emit_signal("hit", "sword", 100)
emit_signal("game_over")

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object during idle time. Always returns null, not the method’s result.

Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they’ll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.

This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which call_deferred was called.

See also call_deferred.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

Note: If you’re looking to delay the function call by a frame, refer to the SceneTree.process_frame and SceneTree.physics_frame signals.

var node = Node3D.new()
# Make a Callable and bind the arguments to the node's rotate() call.
var callable = node.rotate.bind(Vector3(1.0, 0.0, 0.0), 1.571)
# Connect the callable to the process_frame signal, so it gets called in the next process frame.
# CONNECT_ONE_SHOT makes sure it only gets called once instead of every frame.
get_tree().process_frame.connect(callable, CONNECT_ONE_SHOT)
§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Assigns value to the given property, at the end of the current frame. This is equivalent to calling set through call_deferred.

var node = Node2D.new()
add_child(node)

node.rotation = 1.5
node.set_deferred("rotation", 3.0)
print(node.rotation) # Prints 1.5

await get_tree().process_frame
print(node.rotation) # Prints 3.0

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &AnyArray, ) -> Variant

Calls the method on the object and returns the result. Unlike call, this method expects all parameters to be contained inside arg_array.

var node = Node3D.new()
node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571])

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_method(&self, method: impl AsArg<StringName>) -> bool

Returns true if the given method name exists in the object.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32

Returns the number of arguments of the given method by name.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given signal name exists in the object.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the list of existing signals as an Array of dictionaries.

Note: Due to the implementation, each Dictionary is formatted very similarly to the returned values of get_method_list.

pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary<Variant, Variant>>

Returns an Array of connections for the given signal name. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the connected Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>

Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )

Disconnects a signal by name from a given callable. If the connection does not exist, generates an error. Use is_connected to make sure that the connection exists.

pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool

Returns true if a connection exists between the given signal name and callable.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool

Returns true if any connection exists on the given signal name.

Note: In C#, signal must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn set_block_signals(&mut self, enable: bool)

If set to true, the object becomes unable to emit signals. As such, emit_signal and signal connections will not work, until it is set to false.

pub fn is_blocking_signals(&self) -> bool

Returns true if the object is blocking its signals from being emitted. See set_block_signals.

pub fn notify_property_list_changed(&mut self)

Emits the property_list_changed signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.

pub fn set_message_translation(&mut self, enable: bool)

If set to true, allows the object to translate messages with tr and tr_n. Enabled by default. See also can_translate_messages.

pub fn can_translate_messages(&self) -> bool

Returns true if the object is allowed to translate messages with tr and tr_n. See also set_message_translation.

pub fn tr(&self, message: impl AsArg<StringName>) -> GString

To set the default parameters, use tr_ex and its builder methods. See the book for detailed usage instructions. Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>

Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString

To set the default parameters, use tr_n_ex and its builder methods. See the book for detailed usage instructions. Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn tr_n_ex<'ex>( &'ex self, message: impl AsArg<StringName> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExTrN<'ex>

Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn get_translation_domain(&self) -> StringName

Returns the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)

Sets the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn is_queued_for_deletion(&self) -> bool

Returns true if the queue_free method was called for the object.

pub fn cancel_free(&mut self)

If this method is called during ObjectNotification::PREDELETE, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.

pub fn notify(&mut self, what: ObjectNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ObjectNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Trait Implementations§

§

impl Bounds for PhysicsServer3DExtension

§

type Memory = MemManual

Defines the memory strategy of the static type.
§

type Declarer = DeclEngine

Whether this class is a core Godot class provided by the engine, or declared by the user as a Rust struct.
§

impl Debug for PhysicsServer3DExtension

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Deref for PhysicsServer3DExtension

§

type Target = PhysicsServer3D

The resulting type after dereferencing.
§

fn deref(&self) -> &<PhysicsServer3DExtension as Deref>::Target

Dereferences the value.
§

impl DerefMut for PhysicsServer3DExtension

§

fn deref_mut(&mut self) -> &mut <PhysicsServer3DExtension as Deref>::Target

Mutably dereferences the value.
§

impl GodotClass for PhysicsServer3DExtension

§

const INIT_LEVEL: InitLevel = crate::init::InitLevel::Servers

Initialization level, during which this class should be initialized with Godot. Read more
§

type Base = PhysicsServer3D

The immediate superclass of T. This is always a Godot engine class.
§

fn class_id() -> ClassId

Globally unique class ID, linked to the name under which the class is registered in Godot. Read more
§

fn inherits<Base>() -> bool
where Base: GodotClass,

Returns whether Self inherits from Base. Read more
§

impl Inherits<Object> for PhysicsServer3DExtension

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl Inherits<PhysicsServer3D> for PhysicsServer3DExtension

§

const IS_SAME_CLASS: bool = false

True iff Self == Base. Read more
§

impl WithSignals for PhysicsServer3DExtension

§

type SignalCollection<'c, C: WithSignals> = SignalsOfObject<'c, C>

The associated struct listing all signals of this class. Read more
§

impl GodotDefault for PhysicsServer3DExtension

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Inherits<T> for T
where T: GodotClass,

§

const IS_SAME_CLASS: bool = true

True iff Self == Base. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> NewAlloc for T
where T: GodotDefault<Memory = MemManual> + Bounds,

§

fn new_alloc() -> Gd<T>

Return a new, manually-managed Gd containing a default-constructed instance. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> UniformObjectDeref<DeclEngine> for T
where T: GodotClass<Declarer = DeclEngine>,

§

type TargetRef<'a> = Gd<T>

§

type TargetMut<'a> = Gd<T>

§

fn object_as_ref<'a>( gd: &'a Gd<T>, ) -> <T as UniformObjectDeref<DeclEngine>>::TargetRef<'a>

§

fn object_as_mut<'a>( gd: &'a mut Gd<T>, ) -> <T as UniformObjectDeref<DeclEngine>>::TargetMut<'a>