Struct bevy_mod_picking::RayCastSource
source · [−]pub struct RayCastSource<T> {
pub cast_method: RayCastMethod,
/* private fields */
}
Expand description
The RayCastSource
component is used to generate rays with the specified cast_method
. A ray
is generated when the RayCastSource is initialized, either by waiting for update_raycast system
to process the ray, or by using a with_ray
function.
Fields
cast_method: RayCastMethod
Implementations
Instantiates a RayCastSource. It will not be initialized until the update_raycast system
runs, or one of the with_ray
functions is run.
pub fn with_ray_screenspace(
&self,
cursor_pos_screen: Vec2,
windows: &Res<'_, Windows>,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
pub fn with_ray_screenspace(
&self,
cursor_pos_screen: Vec2,
windows: &Res<'_, Windows>,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
Initializes a RayCastSource with a valid screenspace ray.
Initializes a RayCastSource with a valid ray derived from a transform.
pub fn new_screenspace(
cursor_pos_screen: Vec2,
windows: &Res<'_, Windows>,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
pub fn new_screenspace(
cursor_pos_screen: Vec2,
windows: &Res<'_, Windows>,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
Instantiates and initializes a RayCastSource with a valid screenspace ray.
Initializes a RayCastSource with a valid ray derived from a transform.
Instantiates a RayCastSource with RayCastMethod::Transform, and an empty ray. It will not be initialized until the update_raycast system is run and a [GlobalTransform] is present on this entity.
Warning
Only use this if the entity this is associated with will have its [Transform] or [GlobalTransform] specified elsewhere. If the [GlobalTransform] is not set, this ray casting source will never be able to generate a raycast.
Trait Implementations
impl<T> Component for RayCastSource<T> where
RayCastSource<T>: 'static,
RayCastSource<T>: Send,
RayCastSource<T>: Sync,
impl<T> Component for RayCastSource<T> where
RayCastSource<T>: 'static,
RayCastSource<T>: Send,
RayCastSource<T>: Sync,
type Storage = TableStorage
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for RayCastSource<T> where
T: RefUnwindSafe,
impl<T> Send for RayCastSource<T> where
T: Send,
impl<T> Sync for RayCastSource<T> where
T: Sync,
impl<T> Unpin for RayCastSource<T> where
T: Unpin,
impl<T> UnwindSafe for RayCastSource<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
pub fn from_world(_world: &mut World) -> T
pub fn from_world(_world: &mut World) -> T
Creates Self
using data from the given [World]
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more