I am getting an error when trying to clear mesh geometry data in the newest version of babylon.
I tried creating the same error in the playground but I could not get it working:
Here is the code for the custom mesh:
import { MeshSetData, VoxelMeshInterface } from "Meta/Render/Meshes/VoxelMesh.interface";
import { FluidMaterial } from "../../Materials/Fluid/FluidMaterial.js";
export const FluidMesh: VoxelMeshInterface = {
pickable: false,
checkCollisions: false,
seralize: false,
clearCachedGeometry: false,
createTemplateMesh(scene: BABYLON.Scene) {
const mesh = new BABYLON.Mesh("fluid", scene);
mesh.isPickable = this.pickable;
mesh.checkCollisions = this.checkCollisions;
if(!this.checkCollisions) {
mesh.doNotSyncBoundingInfo = true;
}
mesh.doNotSerialize = this.seralize;
return mesh;
},
syncSettings(settings) {
if (settings.meshes.pickable) {
this.pickable = true;
}
if (settings.meshes.clearChachedGeometry) {
this.clearCachedGeometry = true;
}
if (settings.meshes.checkFluidCollisions) {
this.checkCollisions = true;
}
if (settings.meshes.seralize) {
this.seralize = true;
}
},
_applyVertexData(mesh: BABYLON.Mesh, data: MeshSetData) {
mesh.unfreezeWorldMatrix();
const chunkVertexData = new BABYLON.VertexData();
chunkVertexData.positions = data.positionArray;
chunkVertexData.indices = data.indiciesArray;
chunkVertexData.normals = data.normalsArray;
chunkVertexData.applyToMesh(mesh, false);
mesh.setVerticesData("cuv3", data.uvArray, false, 3);
mesh.setVerticesData("ocuv3", data.overlayUVArray, false, 4);
mesh.setVerticesData("faceData", data.faceDataArray, false, 1);
mesh.setVerticesData("rgbLightColors", data.RGBLightColorsArray, false, 4);
mesh.setVerticesData("sunLightColors", data.sunLightColorsArray, false, 4);
mesh.setVerticesData("colors", data.colorsArray, false, 4);
if(this.clearCachedGeometry) {
mesh.geometry?.clearCachedData();
}
mesh.freezeWorldMatrix();
},
async rebuildMeshGeometory(mesh, data) {
this._applyVertexData(mesh,data);
return mesh;
},
async createMeshGeometory(mesh, data) {
mesh.material = FluidMaterial.getMaterial();
this._applyVertexData(mesh,data);
return mesh;
},
};
Here is what the error says:
It only happens if I disable collision detecting which I do.
I tried disabling collisions on the scene also and that did not work.
This worked just fine a few updates ago and now it is broken.
Any help would be much appreciated.