Havok PhysicsAggregate only accepts transform as first param

Ah family, it’s good to see you again :slight_smile:

I said I would and I’m on it! BJS6 this weekend! MEGA UPGRADE WEEKEND!!!

Problem number one:

The docs give a super simples example of using a PhysicsAggregate, but that accepts a transform acording to the type, so I think the example will throw a type error if we try and pass in a mesh, or rather it’s throwing a type error haha.

  var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
  sphere.position.y = 4;
  var hk = new BABYLON.HavokPlugin();
  scene.enablePhysics(new BABYLON.Vector3(0, -9.8, 0), hk);
//PhysicsAggregate doesn't accept mesh as the first argument.
  var sphereAggregate = new BABYLON.PhysicsAggregate(sphere, BABYLON.PhysicsShapeType.SPHERE, { mass: 1, restitution:0.75}, scene);

The second random thing and this could totally be an issue with vite build, but the havoc .wasm will try to get loaded from node_modules/.vite/deps , I fell into a HUGE rabbit hole trying to solve something similar with ammo wasm, because when you build it with emscripten, it builds for a node environment and obivously we’re in the browser so path and fs won’t be available there will be much pain and serious trauma.

I haven’t spent more than a second trying to solve this yet, but like the other solider, I’ve just copied the .wam to a mock node_modules/.vite/deps dir for now.

The class hierarchy for Mesh is: TransformNodeAbstractMeshMesh, so passing a mesh works and will not raise a type error.

I don’t know Vite, so I can’t help you with that, sorry.

@Evgeni_Popov I’m so sorry, you’re right, I think the typescript langauge server got into a funny state and ended up telling me all sorts of fairytales :slight_smile: thanks for the clarity.

1 Like

@potato_noob Could not find a declaration file for module '@babylonjs/havok' - #14 by thomasaull

1 Like

@thomasaull You legend, thank you! super clean!!!

1 Like