use na::{Transform, Rotate}; use na; use entities::bounding_volume::AABB; use entities::shape::Cuboid; use ray::{Ray, RayCast, RayIntersection}; use math::{Point, Vector}; impl RayCast for Cuboid where P: Point, M: Transform

+ Rotate { #[inline] fn toi_with_ray(&self, m: &M, ray: &Ray

, solid: bool) -> Option<::Scalar> { let dl = na::origin::

() + (-*self.half_extents()); let ur = na::origin::

() + *self.half_extents(); AABB::new(dl, ur).toi_with_ray(m, ray, solid) } #[inline] fn toi_and_normal_with_ray(&self, m: &M, ray: &Ray

, solid: bool) -> Option> { let dl = na::origin::

() + (-*self.half_extents()); let ur = na::origin::

() + *self.half_extents(); AABB::new(dl, ur).toi_and_normal_with_ray(m, ray, solid) } #[inline] fn toi_and_normal_and_uv_with_ray(&self, m: &M, ray: &Ray

, solid: bool) -> Option> { let dl = na::origin::

() + (-*self.half_extents()); let ur = na::origin::

() + *self.half_extents(); AABB::new(dl, ur).toi_and_normal_and_uv_with_ray(m, ray, solid) } }