1 #ifndef AWFUL_COLLISION_RAYCOLLISION_H_
2 #define AWFUL_COLLISION_RAYCOLLISION_H_
5 #include "collision/collision_export.h"
9 namespace awful
{ namespace collision
11 struct AWCOLLISION_EXPORT RayCollision
15 bool rayTest( Pointer
< Ray
> pRay
, Pointer
< PlaceableGeom
> pGeom
)
19 pRay
->updatePosition();
20 pGeom
->updatePosition();
22 if( !dCollide( pRay
->m_GeomID
, pGeom
->m_GeomID
, 1, &contact
, 0 ) )
25 m_position
.x() = contact
.pos
[0];
26 m_position
.y() = contact
.pos
[1];
27 m_position
.z() = contact
.pos
[2];
29 m_normal
.x() = contact
.normal
[0];
30 m_normal
.y() = contact
.normal
[1];
31 m_normal
.z() = contact
.normal
[2];
33 m_depth
= contact
.depth
;
38 math::Vector3f
& position() { return m_position
; }
39 math::Vector3f
& normal() { return m_normal
; }
40 float& depth() { return m_depth
; }
41 const math::Vector3f
& position() const { return m_position
; }
42 const math::Vector3f
& normal() const { return m_normal
; }
43 const float& depth() const { return m_depth
; }
46 math::Vector3f m_position
;
47 math::Vector3f m_normal
;