Error with IntersectsMesh! What is the best way to use it?

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.

Welcome to the forum.

Most questions are best accompanied by a playground giving an example of your problem.
https://www.babylonjs-playground.com/

It could be a scope issue, as it is saying browser is undefined.

I can’t say I know the answer to the second question.

When you say “everybody’s ready” makes me thing you are talking about doing a multiclient app?

It would be really hard to trouble shoot your setup without seeing it, but I bet the browser object never got defined correctly.

Thank you !
I’ll follow your advice. The playground is great for that true.

The problem I solved by changing the way of checking the items!