15 #include "bulletAllHitsRayResult.h"
22 BulletAllHitsRayResult::
23 BulletAllHitsRayResult(
const btVector3 &from_pos,
const btVector3 &to_pos,
const CollideMask &mask)
24 : btCollisionWorld::AllHitsRayResultCallback(from_pos, to_pos), _mask(mask) {
36 btCollisionObject *obj0 = (btCollisionObject *) proxy0->m_clientObject;
40 return (_mask & mask0) != 0;
49 addSingleResult(btCollisionWorld::LocalRayResult& rayResult,
bool normalInWorldSpace) {
52 if (rayResult.m_localShapeInfo) {
53 _shapePart.push_back(rayResult.m_localShapeInfo->m_shapePart);
54 _triangleIndex.push_back(rayResult.m_localShapeInfo->m_triangleIndex);
57 _shapePart.push_back(-1);
58 _triangleIndex.push_back(-1);
62 return btCollisionWorld::AllHitsRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
70 LPoint3 BulletAllHitsRayResult::
71 get_from_pos()
const {
73 return btVector3_to_LPoint3(m_rayFromWorld);
81 LPoint3 BulletAllHitsRayResult::
84 return btVector3_to_LPoint3(m_rayToWorld);
92 bool BulletAllHitsRayResult::
103 PN_stdfloat BulletAllHitsRayResult::
104 get_closest_hit_fraction()
const {
106 return (PN_stdfloat)m_closestHitFraction;
114 int BulletAllHitsRayResult::
115 get_num_hits()
const {
117 return m_collisionObjects.size();
126 get_hit(
int idx)
const {
132 hit._object = m_collisionObjects[idx];
133 hit._normal = m_hitNormalWorld[idx];
134 hit._pos = m_hitPointWorld[idx];
135 hit._fraction = m_hitFractions[idx];
137 hit._shapePart = _shapePart[idx];
138 hit._triangleIndex = _triangleIndex[idx];
148 PN_stdfloat BulletRayHit::
149 get_hit_fraction()
const {
151 return (PN_stdfloat)_fraction;
162 return (_object) ? (
PandaNode *)_object->getUserPointer() : NULL;
171 get_hit_pos()
const {
173 return btVector3_to_LPoint3(_pos);
182 get_hit_normal()
const {
184 return btVector3_to_LVector3(_normal);
193 get_shape_part()
const {
204 get_triangle_index()
const {
206 return _triangleIndex;
A basic node of the scene graph or data graph.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
Override default implementation.
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Override default implementation.
static BulletRayHit empty()
Named constructor intended to be used for asserts with have to return a concrete value.