Some doubts about my learning until now

Firs of all, sorry if here isn’t the right place to as that kind of question

I’ve been studding babylon for a month I believe and I have some core doubts that I still don’t get until now, here they are:

FaceUV numbers

How does exactly FaceUV indexes and parameters work? I’ve testing and using them but I don’t get what the values mean relatively to the image. The numbers I’m talking about are these:

faceUV[0] = new BABYLON.Vector4(0.5, 0.0, 0.75, 1.0);
faceUV[1] = new BABYLON.Vector4(0.0, 0.0, 0.25, 1.0);
faceUV[2] = new BABYLON.Vector4(0.25, 0, 0.5, 1.0);
faceUV[3] = new BABYLON.Vector4(0.75, 0, 1.0, 1.0);

I try to treat these numbers like 0.5 as 50% of the image, 1 as 100% of the image, but I don’t know if this is right or make any sense, I believe I’m wrong actually, so what exactly mean these numbers?

Clone vs instance

Is there any performance/memory issue if I instantiate many objects instead of clone them? Supposing I have a mesh for a house, but instead of clone a base house I instantiate many of them, is this bad or don’t have difference?

I’m asking this cause I’m using a for loop to create mashes based on data of each index of the array, but I don’t use clone, I use CreateBox instead of clone a base box.

Space units

I get that if I create a cube without specify the size it will have a size of 1x1x1, but what this “1” is exactly? It make sense to attach an unit for it? Like we do with px, em, cm.

I’m asking this cause I don’t know what is “too big” or “too small” 1 is small? It is big?

Does this question make any sense? :sweat_smile:

External libraries

I just realize that Babylon use some external libs such as CannonJS, but why this isn’t a dependency of the babylonjs itself? I mean, as many people I fall on the “Cannon is not defined” issue what leads me to think why this isn’t added as a dependency, I want to know this just for curiosity.

Still with the libs doubt, is there any recommended way to add these libs on the project? The cleanest way I’ve found to import this were with CDN (with babylon cdn btw), but this don’t seems much safe to me, but when I try to add as a package it shows me the “require is not defined” error. What, again, leads me to the question of “why this isn’t added on the babylonjs”?

(u0, v0, u1, v1) where u0, v0 give bottom left coords and u1, v1 give top right coords of the rectangle covering the wanted part of the texture image.

You are right in that 0.5 is 50% of width or height of image.

1 Like

Both clones and instances share geometry. Instances share more. You can change materials on clones but not instances

So it depends how different your data is for each mesh.

The solid particle system and thin instance can perform better in many cases depending on your use.

See Copies, Clones, and Instancing | Babylon.js Documentation

1 Like

The unit is whatever you want it to be for your project. If your project is about atoms the 1 could be one angstrom, if about buildings 1 could be one metre, if about space 1 could be one million kilometres.

A box of side 1 seen by a camera 10 away will appear on screen the same size whether you are working in angstrom, metres or million kilometres

1 Like

We do not want to flood the base library with optional external dependencies. We do everything possible to reduce the bundle size. As we support at least 3 different physics engines we let the user decides which one you need and if you need none you do not have to download them :slight_smile:

Linking them from the CDN is totally fine and actually the recommended way :slight_smile:

I just can’t give you all the “solution” mark, but thank you everyone, it helps me a lot! :heart_eyes: