Hi there,
I have troubles with Havok. If I create a PhysicsAggregate of type MESH, then dispose both the aggregate and the mesh later, the next time I try to create a PhysicsAggregate from a brand new mesh it fails.
The error is :
Error: No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).
… but if I inspect the mesh, everything is ok, even the number of vertices (even mesh.getVerticesData( VertexBuffer.PositionKind ) is correct).
I’m using the MeshBuilder (CreateBox, CreatePolyhedron, etc) for the mesh creation, not an imported file.
The creation code :
const dieMesh = MeshBuilder.CreateBox( 'D6' , { size: this.dieSize , faceUV , wrap: true } , this.scene ) ;
dieMesh.material = dieMaterial ;
const dieAggregate = new PhysicsAggregate(
dieMesh ,
PhysicsShapeType.MESH ,
this.diePhysicsParams ,
this.scene
) ;
The dispose code :
dieAggregate.dispose() ;
dieMesh.dispose() ;
Nothing fancy here.
I also tried to delay the new PhysicsAggregate() or the mesh.dispose(). It works with type PhysicsShapeType.BOX but since I also create polyhedrons (it’s for a physical dice roller project, so there are tetrahedron, octahedron, dodecahedron and icosahedron so far). Also the type PhysicsShapeType.CONVEX_HULL is not working even from the start.
I’m on the latest Babylon.js and Havok from npm : @babylonjs/core v9.11.0 and @babylonjs/havok v1.3.12. Am I using some unstable version ?
Also it’s inside a Tauri/Vue.js/Vite stack, not sure if that’s important…