pub struct HeightFieldCollider;Expand description
Collision detector for ray-heightfield intersection.
Implementations§
Source§impl HeightFieldCollider
impl HeightFieldCollider
Sourcepub fn ray_cast(
surface: &HeightFieldSurface,
origin: Vec3,
direction: Vec3,
max_distance: f32,
step_size: f32,
) -> Option<HeightFieldHit>
pub fn ray_cast( surface: &HeightFieldSurface, origin: Vec3, direction: Vec3, max_distance: f32, step_size: f32, ) -> Option<HeightFieldHit>
Cast a ray against a height field surface using ray marching + binary search refinement.
The ray starts at origin and moves in direction (should be normalized).
max_distance limits the search. step_size controls the initial march resolution.
Sourcepub fn is_above(surface: &HeightFieldSurface, point: Vec3) -> bool
pub fn is_above(surface: &HeightFieldSurface, point: Vec3) -> bool
Test if a point is above or below the terrain.
Sourcepub fn distance_to_surface(surface: &HeightFieldSurface, point: Vec3) -> f32
pub fn distance_to_surface(surface: &HeightFieldSurface, point: Vec3) -> f32
Get the vertical distance from a point to the terrain surface.
Sourcepub fn project_onto(surface: &HeightFieldSurface, point: Vec3) -> Vec3
pub fn project_onto(surface: &HeightFieldSurface, point: Vec3) -> Vec3
Project a point onto the terrain (snap Y to terrain height).
Sourcepub fn sphere_intersects(
surface: &HeightFieldSurface,
center: Vec3,
radius: f32,
) -> bool
pub fn sphere_intersects( surface: &HeightFieldSurface, center: Vec3, radius: f32, ) -> bool
Sphere-terrain intersection test.
Returns true if a sphere at center with given radius intersects the terrain.
Auto Trait Implementations§
impl Freeze for HeightFieldCollider
impl RefUnwindSafe for HeightFieldCollider
impl Send for HeightFieldCollider
impl Sync for HeightFieldCollider
impl Unpin for HeightFieldCollider
impl UnsafeUnpin for HeightFieldCollider
impl UnwindSafe for HeightFieldCollider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn 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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.