Struct bevy_mod_picking::RayCastSource
source · [−]pub struct RayCastSource<T> {
pub cast_method: RayCastMethod,
pub ray: Option<Ray3d>,
/* 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
ray: Option<Ray3d>
Implementations
sourceimpl<T> RayCastSource<T>
impl<T> RayCastSource<T>
sourcepub fn new() -> RayCastSource<T>
pub fn new() -> RayCastSource<T>
Instantiates a RayCastSource. It will not be initialized until the update_raycast system
runs, or one of the with_ray
functions is run.
sourcepub fn with_ray_screenspace(
self,
cursor_pos_screen: Vec2,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
pub fn with_ray_screenspace(
self,
cursor_pos_screen: Vec2,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
Initializes a RayCastSource with a valid screenspace ray.
sourcepub fn with_ray_transform(self, transform: Mat4) -> RayCastSource<T>
pub fn with_ray_transform(self, transform: Mat4) -> RayCastSource<T>
Initializes a RayCastSource with a valid ray derived from a transform.
sourcepub fn new_screenspace(
cursor_pos_screen: Vec2,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
pub fn new_screenspace(
cursor_pos_screen: Vec2,
camera: &Camera,
camera_transform: &GlobalTransform
) -> RayCastSource<T>
Instantiates and initializes a RayCastSource with a valid screenspace ray.
sourcepub fn new_transform(transform: Mat4) -> RayCastSource<T>
pub fn new_transform(transform: Mat4) -> RayCastSource<T>
Initializes a RayCastSource with a valid ray derived from a transform.
sourcepub fn new_transform_empty() -> RayCastSource<T>
pub fn new_transform_empty() -> RayCastSource<T>
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.
pub fn intersect_list(&self) -> Option<&Vec<(Entity, IntersectionData), Global>>
pub fn intersect_top(&self) -> Option<(Entity, &IntersectionData)>
pub fn intersect_primitive(&self, shape: Primitive3d) -> Option<IntersectionData>
Trait Implementations
sourceimpl<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
sourceimpl<T> Default for RayCastSource<T>
impl<T> Default for RayCastSource<T>
sourcefn default() -> RayCastSource<T>
fn default() -> RayCastSource<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for RayCastSource<T>
impl<T> Send for RayCastSource<T>
impl<T> Sync for RayCastSource<T>
impl<T> Unpin for RayCastSource<T>
impl<T> UnwindSafe for RayCastSource<T>
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for T where
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for T where
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
Return the T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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,
fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using data from the given [World]
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more