Update tests to check collider kind and flatten triangles
This commit is contained in:
@@ -329,8 +329,10 @@ describe("buildRuntimeSceneFromDocument", () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
expect(Array.from(runtimeScene.colliders[0].vertices)).toHaveLength(24);
|
||||
expect(Array.from(runtimeScene.colliders[0].indices)).toHaveLength(36);
|
||||
const brushCollider = runtimeScene.colliders[0];
|
||||
expect(brushCollider.kind).toBe("trimesh");
|
||||
expect(Array.from(brushCollider.vertices)).toHaveLength(24);
|
||||
expect(Array.from(brushCollider.indices)).toHaveLength(36);
|
||||
expect(runtimeScene.sceneBounds).toEqual({
|
||||
min: {
|
||||
x: -4,
|
||||
|
||||
@@ -80,10 +80,11 @@ describe("box brush geometry", () => {
|
||||
|
||||
const diagnostics = validateBoxBrushGeometry(brush);
|
||||
const derivedMesh = buildBoxBrushDerivedMeshData(brush);
|
||||
const triangles = derivedMesh.faceSurfaces.flatMap((surface) => surface.triangles);
|
||||
|
||||
expect(diagnostics).toEqual([]);
|
||||
expect(derivedMesh.faceSurfaces).toHaveLength(6);
|
||||
expect(derivedMesh.faceSurfaces.every((surface) => surface.triangles).flat()).toHaveLength(12);
|
||||
expect(triangles).toHaveLength(12);
|
||||
expect(Array.from(derivedMesh.colliderIndices)).toHaveLength(36);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user