Not sure why this is so complicated. In other platforms/frameworks you can just pass things back and forth. Itâs almost like I have to reference everything in both places for this to workâŚ.making me think it isnât even worth the hassleâŚ
It wasnât the âthisâ dealâŚâŚitâs the scene and having one in the âmesh generatorâ file to reference the scene in the main scene file where I am initializing the scene.
I have it working for nowâŚâŚbut it still needs some work.
In the vuetify component:
methods:
{
Run()
{
const canvas = document.querySelector("canvasâ)!;
new myScene(canvas, âall my values from vuetify componentsâ
);
}
},
In the main babylon scene that intializes the scene and engine and has the cameras and all that. It is also importing the âMeshGeneratorâ file
MeshGenerator.GetMeshes(scene, "all values to generate meshesâ);
In the mesh generator code, this is how it is set up to create the meshes:
import {
Scene,
Vector3,
MeshBuilder,
Mesh,
} from "@babylonjs/coreâ;
export class MeshGenerator
{
constructor(private scene: Scene) { }
public static GetSpineRoofs(scene: Scene | undefined, "all values to create meshes"): Mesh[]
{
let meshes: Mesh[] = [];
///////////////////////////////////////////////
// meshes
///////////////////////////////////////////////
const mesh = MeshBuilder.CreateBox(âmeshâ, { width: meshLength + 1, height: .5, depth: meshWidth + 1, updatable: true }, scene);
mesh.position = new Vector3(meshlength / 2 - someValue - meshLength / 2,
meshElev + 1,
0
);
meshes.push(mesh);
return meshes;
}
}
I would much rather just send the values from vuetify to the mesh generator file, but nothing I tried would work. This is the only way it would work. By calling the mesh generator from the babylon scene file.