Hello everyone!
I’m studying how Babylonjs works and it’s very simple!
and I’m using to better understand the javascript I’m also studying xD. but when creating a rts game scene I came across this error and can not solve.
in >> scene.onBeforeRenderObservable.add (() => {})
I put the code below it and gave the error ‘intersectsMesh property’ of undefined ', I believe it is a matter of scope.
if (browser.position == pos_start) {
console.log (‘stopped’); } From others {
if (browser.intersectsMesh (box_1)) {
console.log (‘contact’); } else {console.log (‘non-contact’); };
};
I still need to understand how observables work!
I believe this error is because it is checked before the object in question is created.
Another question if anyone can answer! What is the best way to load 3D models for games, to only show the scene if everyone is ready? sometimes the scene opens without a model. I used the method;
BABYLON.SceneLoader.Append ("./objs/", “box.babylon”, scene, function (scene) {
box_1 = scene.meshes [5];
box_1.position = new BABYLON.Vector3 (0, 0, 0);
box_1.scaling = new BABYLON.Vector3 (2, 2, 2);
});
put something on the scene!
thanks and sorry if this in the wrong place the post.