Struct gdnative_bindings_lily::VehicleWheel[][src]

pub struct VehicleWheel { /* fields omitted */ }
Expand description

core class VehicleWheel inherits Spatial (unsafe).

Official documentation

See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.

Memory management

Non reference counted objects such as the ones of this type are usually owned by the engine.

VehicleWheel is a reference-only type. Persistent references can only exist in the unsafe Ref<VehicleWheel> form.

In the cases where Rust code owns an object of this type, for example if the object was just created on the Rust side and not passed to the engine yet, ownership should be either given to the engine or the object must be manually destroyed using Ref::free, or Ref::queue_free if it is a Node.

Class hierarchy

VehicleWheel inherits methods from:

Safety

All types in the Godot API have “interior mutability” in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

Creates a new instance of this object.

Because this type is not reference counted, the lifetime of the returned object is not automatically managed.

Immediately after creation, the object is owned by the caller, and can be passed to the engine (in which case the engine will be responsible for destroying the object) or destroyed manually using Ref::free, or preferably Ref::queue_free if it is a Node.

Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.

The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car.

The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the [member damping_compression] property. For a [member damping_compression] value of 0.3, try a relaxation value of 0.5.

Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. Note: The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears. A negative value will result in the wheel reversing.

This determines how much grip this wheel has. It is combined with the friction setting of the surface the wheel is in contact with. 0.0 means no grip, 1.0 is normal grip. For a drift car setup, try setting the grip of the rear wheels slightly lower than the front wheels, or use a lower value to simulate tire wear. It’s best to set this to 1.0 when starting out.

The radius of the wheel in meters.

This value affects the roll of your vehicle. If set to 1.0 for all wheels, your vehicle will be prone to rolling over, while a value of 0.0 will resist body roll.

Returns the rotational speed of the wheel in revolutions per minute.

Returns a value between 0.0 and 1.0 that indicates whether this wheel is skidding. 0.0 is skidding (the wheel has lost grip, e.g. icy terrain), 1.0 means not skidding (the wheel has full grip, e.g. dry asphalt road).

The steering angle for the wheel. Setting this to a non-zero value will result in the vehicle turning when it’s moving.

The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody.mass] of the VehicleBody or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number.

This is the distance in meters the wheel is lowered from its origin point. Don’t set this to 0.0 and move the wheel into position, instead move the origin point of your wheel (the gizmo in Godot) to the position the wheel will take when bottoming out, then use the rest length to move the wheel down to the position it should be in when the car is in rest.

This value defines the stiffness of the suspension. Use a value lower than 50 for an off-road car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car.

This is the distance the suspension can travel. As Godot units are equivalent to meters, keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car.

Returns true if this wheel is in contact with a surface.

If true, this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody.steering] and ignored if you are using the per-wheel [member steering] value instead.

If true, this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead.

Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.

The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car.

The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the [member damping_compression] property. For a [member damping_compression] value of 0.3, try a relaxation value of 0.5.

Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. Note: The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears. A negative value will result in the wheel reversing.

This determines how much grip this wheel has. It is combined with the friction setting of the surface the wheel is in contact with. 0.0 means no grip, 1.0 is normal grip. For a drift car setup, try setting the grip of the rear wheels slightly lower than the front wheels, or use a lower value to simulate tire wear. It’s best to set this to 1.0 when starting out.

The radius of the wheel in meters.

This value affects the roll of your vehicle. If set to 1.0 for all wheels, your vehicle will be prone to rolling over, while a value of 0.0 will resist body roll.

The steering angle for the wheel. Setting this to a non-zero value will result in the vehicle turning when it’s moving.

The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody.mass] of the VehicleBody or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number.

This is the distance in meters the wheel is lowered from its origin point. Don’t set this to 0.0 and move the wheel into position, instead move the origin point of your wheel (the gizmo in Godot) to the position the wheel will take when bottoming out, then use the rest length to move the wheel down to the position it should be in when the car is in rest.

This value defines the stiffness of the suspension. Use a value lower than 50 for an off-road car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car.

This is the distance the suspension can travel. As Godot units are equivalent to meters, keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car.

If true, this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody.steering] and ignored if you are using the per-wheel [member steering] value instead.

If true, this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead.

Methods from Deref<Target = Spatial>

Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.

The SpatialGizmo for this node. Used for example in EditorSpatialGizmo as custom visualization and editing handles in Editor.

World space (global) Transform of this node.

Returns the parent Spatial, or an empty Object if no parent exists or parent is not of type Spatial.

Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle). Note: In the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three independent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a Vector3 data structure not because the rotation is a vector, but only because Vector3 exists as a convenient data-structure to store 3 floating-point numbers. Therefore, applying affine operations on the rotation “vector” is not meaningful.

Rotation part of the local transformation in degrees, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).

Scale part of the local transformation.

Local space Transform of this node, with respect to the parent node.

Local translation of this node.

Returns the current World resource this Spatial node is registered to.

Rotates the global (world) transformation around axis, a unit Vector3, by specified angle in radians. The rotation axis is in global coordinate system.

Scales the global (world) transformation by the given Vector3 scale factors.

Moves the global (world) transformation by Vector3 offset. The offset is in global coordinate system.

Disables rendering of this node. Changes [member visible] to false.

Returns whether node notifies about its local transformation changes. Spatial will not propagate this by default.

Returns whether this node uses a scale of (1, 1, 1) or its local transformation scale.

Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations.

Returns whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.

If true, this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return true).

Returns true if the node is present in the SceneTree, its [member visible] property is true and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree.

Rotates itself so that the local -Z axis points towards the target position. The transform will first be rotated around the given up vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the target and up vectors. Operations take place in global space.

Moves the node to the specified position, and then rotates itself to point toward the target as per [method look_at]. Operations take place in global space.

Resets this node’s transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node’s Transform.

Rotates the local transformation around axis, a unit Vector3, by specified angle in radians.

Rotates the local transformation around axis, a unit Vector3, by specified angle in radians. The rotation axis is in object-local coordinate system.

Rotates the local transformation around the X axis by angle in radians.

Rotates the local transformation around the Y axis by angle in radians.

Rotates the local transformation around the Z axis by angle in radians.

Scales the local transformation by given 3D scale factors in object-local coordinate system.

Makes the node ignore its parents transformations. Node transformations are only in global space.

Sets whether the node uses a scale of (1, 1, 1) or its local transformation scale. Changes to the local transformation scale are preserved.

The SpatialGizmo for this node. Used for example in EditorSpatialGizmo as custom visualization and editing handles in Editor.

World space (global) Transform of this node.

Reset all transformations for this node (sets its Transform to the identity matrix).

Sets whether the node ignores notification that its transformation (global or local) changed.

Sets whether the node notifies about its local transformation changes. Spatial will not propagate this by default.

Sets whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.

Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle). Note: In the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three independent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a Vector3 data structure not because the rotation is a vector, but only because Vector3 exists as a convenient data-structure to store 3 floating-point numbers. Therefore, applying affine operations on the rotation “vector” is not meaningful.

Rotation part of the local transformation in degrees, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).

Scale part of the local transformation.

Local space Transform of this node, with respect to the parent node.

Local translation of this node.

If true, this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return true).

Enables rendering of this node. Changes [member visible] to true.

Transforms local_point from this node’s local space to world space.

Transforms global_point from world space to this node’s local space.

Changes the node’s position by the given offset Vector3. Note that the translation offset is affected by the node’s scale, so if scaled by e.g. (10, 1, 1), a translation by an offset of (2, 0, 0) would actually add 20 (2 * 10) to the X coordinate.

Changes the node’s position by the given offset Vector3 in local space.

Updates the SpatialGizmo of this node.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

Creates an explicitly null reference of Self as a method argument. This makes type inference easier for the compiler compared to Option. Read more

Creates a new instance of Self using a zero-argument constructor, as a Unique reference. Read more

Performs a dynamic reference downcast to target type. Read more

Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more

Creates a persistent reference to the same Godot object with shared thread access. Read more

Creates a persistent reference to the same Godot object with thread-local thread access. Read more

Creates a persistent reference to the same Godot object with unique access. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive. See also TRef::try_from_instance_id. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive, and panics otherwise. This does NOT guarantee that the resulting reference is safe to use. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.