Struct gdnative_bindings_lily::RayCast [−][src]
pub struct RayCast { /* fields omitted */ }
Expand description
core class RayCast
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.
RayCast
is a reference-only type. Persistent references can
only exist in the unsafe Ref<RayCast>
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
RayCast 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
.
Adds a collision exception so the ray does not report collisions with the specified node.
Adds a collision exception so the ray does not report collisions with the specified [RID].
Removes all collision exceptions for this ray.
Updates the collision information for the ray.
Use this method to update the collision information immediately instead of waiting for the next _physics_process
call, for example if the ray or its parent has changed state.
Note: enabled
is not required for this to work.
The ray’s destination point, relative to the RayCast’s position
.
Returns the first object that the ray intersects, or null
if no object is intersecting the ray (i.e. [method is_colliding] returns false
).
Returns the shape ID of the first object that the ray intersects, or 0
if no object is intersecting the ray (i.e. [method is_colliding] returns false
).
The ray’s collision mask. Only objects in at least one collision layer enabled in the mask will be detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
Returns true
if the bit index passed is turned on.
Note: Bit indices range from 0-19.
Returns the normal of the intersecting object’s shape at the collision point.
Returns the collision point at which the ray intersects the closest object. Note: This point is in the global coordinate system.
If true
, collisions will be ignored for this RayCast’s immediate parent.
If true
, collision with Areas will be reported.
If true
, collision with PhysicsBodys will be reported.
Returns whether any object is intersecting with the ray’s vector (considering the vector length).
If true
, collisions will be reported.
Removes a collision exception so the ray does report collisions with the specified node.
Removes a collision exception so the ray does report collisions with the specified [RID].
The ray’s destination point, relative to the RayCast’s position
.
If true
, collision with Areas will be reported.
If true
, collision with PhysicsBodys will be reported.
The ray’s collision mask. Only objects in at least one collision layer enabled in the mask will be detected. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
Sets the bit index passed to the value
passed.
Note: Bit indexes range from 0-19.
If true
, collisions will be reported.
If true
, collisions will be ignored for this RayCast’s immediate parent.
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.
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).
Local space Transform of this node, with respect to the parent node.
Local translation of this node.
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.
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).
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
).
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
type RefKind = ManuallyManaged
type RefKind = ManuallyManaged
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
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
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
Auto Trait Implementations
impl RefUnwindSafe for RayCast
impl UnwindSafe for RayCast