Hi, I am trying to use the Havok plugin to perform raycasting in my project. I used the following documentation:
There are a few problems I am running in to. First of all, it seems like the raycastToRef method does not exist on my physicsEngine. It only has the raycast method available. I am not sure exactly what is the difference between the two and if it matters which one I use. Second, when calling the raycast method with a start and end Vector3 as input, I get the following error:
My code is as follows:
const havokInstance = await HavokPhysics();
const hk = new HavokPlugin(true, havokInstance);
scene.enablePhysics(new Vector3(0, -9.8, 0), hk);
const physicsEngine = scene.getPhysicsEngine();
let res = physicsEngine?.raycast(Vector3.Zero(), new Vector3(1, 1, 1));
console.log(res);
I’ve searched across the web for this error, but barely any search results show up and I have not been able to find similar problems on the forum here. I am using BabylonJS v6.10.0 and I installed Havok using the npm package @babylonjs/havok.
On the playground it seems to work as intended: Babylon.js Playground