author Yannick Deubel (https://github.com/yandeu)
 *  copyright license https import { AmmoPhysics } from '../physics' ; import { ExtendedObject3D } from '@enable3d/common/dist/types' ; import { logger } from '@enable3d/common/dist/logger' ; export default class AllHitsRayResultCallback { protected _btRayCallback ! : Ammo . AllHitsRayResultCallback ; constructor ( protected physics ) { } getHitPointsWorld ( ) { const h = this . _btRayCallback . get_m_hitPointWorld ( ) as Ammo . btVector3Array ; const points = [ ] ; for ( let i = h . size ( ) - 1 ; i >= 0 ; i -- ) { const hh = h . at ( i ) ; points . push ( { x : hh . x ( ) , y : hh . y ( ) , z : hh . z ( ) } ) ; } return points ; } getHitPointWorld ( ) { logger ( 'Use getHitPointsWorld() instead of getHitPointWorld() for the AllHitsRayCaster!' ) ; return this . getHitPointsWorld ( ) ; } getHitNormalsWorld ( ) { const h = this . _btRayCallback . get_m_hitNormalWorld ( ) ; const normals = [ ] ; for ( let i = h . size ( ) - 1 ; i >= 0 ; i -- ) { const hh = h . at ( i ) ; normals . push ( { x : hh . x ( ) , y : hh . y ( ) , z : hh . z ( ) } ) ; } return normals ; } getCollisionObjects ( ) { const threeObjects = [ ] ; const objects = this . _btRayCallback . get_m_collisionObjects ( ) ; for ( let i = objects . size ( ) - 1 ; i >= 0 ; i -- ) { const rb = Ammo . castObject ( objects . at ( i ) , Ammo . btRigidBody ) ; threeObjects . push ( rb . threeObject ) ; } return threeObjects ; } }