When trying to construct a PhysicsRaycastResult class like so:
let hitResult:BABYLON.PhysicsRaycastResult = new BABYLON.PhysicsRaycastResult()
Uncaught TypeError: BABYLON.PhysicsRaycastResult is not a constructor
at TestController.update (WTFComp.ts:27)
at Function.n.BeforeInstance (babylon.manager.js:3)
at r._before [as callback] (babylon.manager.js:3)
at e.notifyObservers (babylon.min.js:16)
at t.render (babylon.min.js:16)
at index.html:312
at t._renderFrame (babylon.min.js:16)
at t._renderLoop (babylon.min.js:16)
Yo @Deltakosh … Are we missing a constructor on that class or what ???
I think you are not supposed to instantiate PhysicsRaycastResult
yourself but instead use the raycast
method of the physic engine of your choice, which will return a PhysicsRaycastResult
.
I am doing native Ammo.js Raycast but wanted to wrap in an API like the PhysicsPlugin.raycast() function does… Which is use a PhysicsRaycastResult as a result buffer and re-using the result buffer each raycast then it update the point and normal hit data.
But now matter what… Somewhere you gotta instantiate an instance to work with.
I end up making my own updatable BABYLON.RaycastHitResult class for my SceneManager extension… I need a spot to store the native btCollisionObject anyways… Beside i also support collision filter groups and masks.