11 #include <QScopedPointer>
15 #include "BulletClosestRayCallback.h"
16 #include "BulletTargetShape.h"
17 #include "Constants.h"
18 #include "IException.h"
19 #include "IsisBullet.h"
20 #include "SurfacePoint.h"
22 #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
32 btCollisionWorld::ClosestRayResultCallback(btVector3(0,0,0), btVector3(0,0,0)),
33 m_point(0.0, 0.0, 0.0), m_normal(0.0, 0.0, 0.0),
34 m_triangleIndex(-1), m_partId(-1) {
51 const btVector3 &point,
52 const btVector3 &normal) :
53 btCollisionWorld::ClosestRayResultCallback(result.observer(), result.lookdir()) {
68 const btVector3 &lookdir) :
69 btCollisionWorld::ClosestRayResultCallback(observer, lookdir),
70 m_point(0.0, 0.0, 0.0), m_normal(0.0, 0.0, 0.0),
71 m_triangleIndex(-1), m_partId(-1) {
95 const btVector3 &lookdir,
96 const btCollisionWorld::RayResultCallback &source,
97 btCollisionWorld::LocalRayResult &rayResult,
98 bool normalInWorldSpace) :
99 btCollisionWorld::ClosestRayResultCallback(observer, lookdir),
100 m_point(0.0, 0.0, 0.0), m_normal(0.0, 0.0, 0.0),
101 m_triangleIndex(-1), m_partId(-1) {
131 return ( ClosestRayResultCallback::m_rayFromWorld );
141 return ( ClosestRayResultCallback::m_rayToWorld );
158 return ( RayResultCallback::m_closestHitFraction );
172 "No hits in ray trace so no surface point!",
174 return ( btVector3(0.0, 0.0, 0.0) );
189 "No hits in ray trace so no normal!",
191 return btVector3(0.0, 0.0, 0.0);
222 if ( !
isValid() )
return (DBL_MAX);
253 if ( !
isValid() )
return (DBL_MAX);
292 const btScalar tolerance)
const {
298 if (
distance( other ) > tolerance )
return (
false );
315 return (
static_cast<const BulletTargetShape *
> (m_collisionObject->getUserPointer()) );
334 bool normalInWorldSpace) {
335 btScalar hitFraction = ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
337 m_point = m_hitPointWorld;
342 m_partId = rayResult.m_localShapeInfo->m_shapePart;
343 return (hitFraction);
354 return ( (btTriangleRaycastCallback::kF_FilterBackfaces |
355 btTriangleRaycastCallback::kF_KeepUnflippedNormal |
356 btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest) );
366 const btCollisionWorld::RayResultCallback &source) {