19 BulletAllHitsRayResult::
20 BulletAllHitsRayResult(
const btVector3 &from_pos,
const btVector3 &to_pos,
const CollideMask &mask)
21 : btCollisionWorld::AllHitsRayResultCallback(from_pos, to_pos), _mask(mask) {
31 btCollisionObject *obj0 = (btCollisionObject *) proxy0->m_clientObject;
35 return (_mask & mask0) != 0;
42 addSingleResult(btCollisionWorld::LocalRayResult& rayResult,
bool normalInWorldSpace) {
45 if (rayResult.m_localShapeInfo) {
46 _shapePart.push_back(rayResult.m_localShapeInfo->m_shapePart);
47 _triangleIndex.push_back(rayResult.m_localShapeInfo->m_triangleIndex);
50 _shapePart.push_back(-1);
51 _triangleIndex.push_back(-1);
55 return btCollisionWorld::AllHitsRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
61 LPoint3 BulletAllHitsRayResult::
62 get_from_pos()
const {
64 return btVector3_to_LPoint3(m_rayFromWorld);
70 LPoint3 BulletAllHitsRayResult::
73 return btVector3_to_LPoint3(m_rayToWorld);
79 bool BulletAllHitsRayResult::
88 PN_stdfloat BulletAllHitsRayResult::
89 get_closest_hit_fraction()
const {
91 return (PN_stdfloat)m_closestHitFraction;
97 int BulletAllHitsRayResult::
98 get_num_hits()
const {
100 return m_collisionObjects.size();
107 get_hit(
int idx)
const {
113 hit._object = m_collisionObjects[idx];
114 hit._normal = m_hitNormalWorld[idx];
115 hit._pos = m_hitPointWorld[idx];
116 hit._fraction = m_hitFractions[idx];
118 hit._shapePart = _shapePart[idx];
119 hit._triangleIndex = _triangleIndex[idx];
127 PN_stdfloat BulletRayHit::
128 get_hit_fraction()
const {
130 return (PN_stdfloat)_fraction;
139 return (_object) ? (
PandaNode *)_object->getUserPointer() :
nullptr;
145 LPoint3 BulletRayHit::
146 get_hit_pos()
const {
148 return btVector3_to_LPoint3(_pos);
154 LVector3 BulletRayHit::
155 get_hit_normal()
const {
157 return btVector3_to_LVector3(_normal);
164 get_shape_part()
const {
173 get_triangle_index()
const {
175 return _triangleIndex;
A basic node of the scene graph or data graph.
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Override default implementation.
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
Override default implementation.
static BulletRayHit empty()
Named constructor intended to be used for asserts with have to return a concrete value.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.