# Physics Raycast Result Constructor Bug

**URL:** https://forum.babylonjs.com/t/physics-raycast-result-constructor-bug/7019
**Category:** Bugs
**Created:** [November 16, 2019, 1:18am UTC](https://forum.babylonjs.com/t/physics-raycast-result-constructor-bug/7019 "2019-11-16T01:18:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)
#### Post date: [November 16, 2019, 1:18am UTC](https://forum.babylonjs.com/t/physics-raycast-result-constructor-bug/7019/1 "2019-11-16T01:18:09Z")

</div>

When trying to construct a PhysicsRaycastResult class like so:

```auto
let hitResult:BABYLON.PhysicsRaycastResult = new BABYLON.PhysicsRaycastResult()

```

```auto
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 ???

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [November 16, 2019, 2:00am UTC](https://forum.babylonjs.com/t/physics-raycast-result-constructor-bug/7019/2 "2019-11-16T02:00:55Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)
#### Post date: [November 16, 2019, 2:48am UTC](https://forum.babylonjs.com/t/physics-raycast-result-constructor-bug/7019/3 "2019-11-16T02:48:40Z")

</div>

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.
