virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { if (rayResult.m_collisionObject == m_exclude) return 1.0; //caller already does the filter on the m_closestHitFraction btAssert(rayResult.m_hitFraction <= m_closestHitFraction); m_closestHitFraction = rayResult.m_hitFraction; m_collisionObject = rayResult.m_collisionObject; if (rayResult.m_localShapeInfo) { #ifndef EXTBULLET m_shape = rayResult.m_localShapeInfo->m_shape; #endif m_shapePart = rayResult.m_localShapeInfo->m_shapePart; m_triangleId = rayResult.m_localShapeInfo->m_triangleIndex; } if (normalInWorldSpace) { m_hitNormalWorld = rayResult.m_hitNormalLocal; } else { ///need to transform normal into worldspace m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal; } m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); return rayResult.m_hitFraction; }
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) { elfCollision* collision; m_collisionObject = rayResult.m_collisionObject; if (normalInWorldSpace) { m_hitNormalWorld = rayResult.m_hitNormalLocal; } else { m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal; } m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction); collision = elfCreateCollision(); collision->position.x = m_hitPointWorld.x(); collision->position.y = m_hitPointWorld.y(); collision->position.z = m_hitPointWorld.z(); collision->normal.x = m_hitNormalWorld.x(); collision->normal.y = m_hitNormalWorld.y(); collision->normal.z = m_hitNormalWorld.z(); collision->actor = ((elfPhysicsObject*)((btRigidBody*)m_collisionObject)->getUserPointer())->actor; elfIncRef((elfObject*)collision->actor); elfAppendListObject(m_list, (elfObject*)collision); return rayResult.m_hitFraction; }
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { if (rayResult.m_collisionObject == m_exclude) return 1.0; // fluid triggers - no collision if (rayResult.m_collisionObject->getCollisionFlags() & btCollisionObject::CF_NO_CONTACT_RESPONSE) return 1.0; //caller already does the filter on the m_closestHitFraction btAssert(rayResult.m_hitFraction <= m_closestHitFraction); m_closestHitFraction = rayResult.m_hitFraction; m_collisionObject = rayResult.m_collisionObject; if (!rayResult.m_localShapeInfo) m_shapeId = 0; //crash hf- else // only for btTriangleMeshShape m_shapeId = rayResult.m_localShapeInfo->m_shapePart; if (normalInWorldSpace) { m_hitNormalWorld = rayResult.m_hitNormalLocal; } else { ///need to transform normal into worldspace m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal; } m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); return rayResult.m_hitFraction; }
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { if (normalInWorldSpace) { m_hitNormalWorld = rayResult.m_hitNormalLocal; } else { m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal; } m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction); jmeBulletUtil::addResult(env, resultlist, m_hitNormalWorld, m_hitPointWorld, rayResult.m_hitFraction, rayResult.m_collisionObject); return 1.f; }
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { btCollisionObject* obj = rayResult.m_collisionObject; if (obj == m_exclude) return 1.0; // no other cars collision (for wheel raycasts) ShapeData* sd = (ShapeData*)obj->getUserPointer(); if (bIgnoreCars && sd && sd->type == ST_Car) return 1.0; // car ignores fluids (camera not) if (!bCamTilt && sd && sd->type == ST_Fluid) return 1.0; // always ignore wheel triggers if (sd && sd->type == ST_Wheel) // && (obj->getCollisionFlags() & btCollisionObject::CF_NO_CONTACT_RESPONSE)) return 1.0; // cam ingores dynamic objects (car not) if (bCamTilt && !obj->isStaticObject()) return 1.0; // cam dist ray only for terrain, // todo: would work for rest but loops and pipe glass .. if (bCamDist) { int su = (long)obj->getCollisionShape()->getUserPointer(); if (su != SU_Terrain) return 1.0; } //caller already does the filter on the m_closestHitFraction btAssert(rayResult.m_hitFraction <= m_closestHitFraction); m_closestHitFraction = rayResult.m_hitFraction; m_collisionObject = obj; if (!rayResult.m_localShapeInfo) m_shapeId = 0; //crash hf- else // only for btTriangleMeshShape m_shapeId = rayResult.m_localShapeInfo->m_shapePart; if (normalInWorldSpace) m_hitNormalWorld = rayResult.m_hitNormalLocal; else ///need to transform normal into worldspace m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal; m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); return rayResult.m_hitFraction; }
virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace) { //caller already does the filter on the m_closestHitFraction btAssert(rayResult.m_hitFraction <= m_closestHitFraction); m_closestHitFraction = rayResult.m_hitFraction; m_collisionObject = rayResult.m_collisionObject; if (normalInWorldSpace) { m_hitNormalWorld = rayResult.m_hitNormalLocal; } else { ///need to transform normal into worldspace m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal; } m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); return 1.f; }
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { const btCollisionObject* obj = rayResult.m_collisionObject; if (obj->getUserPointer() != (void*)111) // allow only road return 1.0; //caller already does the filter on the m_closestHitFraction btAssert(rayResult.m_hitFraction <= m_closestHitFraction); m_closestHitFraction = rayResult.m_hitFraction; m_collisionObject = obj; if (normalInWorldSpace) m_hitNormalWorld = rayResult.m_hitNormalLocal; else ///need to transform normal into worldspace m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal; m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction); return rayResult.m_hitFraction; }