Object scaling bug

https://playground.babylonjs.com/#S55F1P
Object zoom in line 41,

The above is the effect after scaling.
The height distance of the group node seems to be scaled by 4 times, which causes the sphere to fail to follow the plane closely.
I don’t know if it’s due to billboardMode :roll_eyes:

You will need to add a mask to the billboard mode in order to get it to work you expected - Scaling bug of billboardMode mode | Babylon.js Playground (babylonjs.com)

What is the principle? Can you explain it

Of course. Billboard add an extra transformation during the compute world matrix process. the default billboard uses the camera’s view matrix, inverses it, and resets the rotation to be applied to the compute matrix according to the billboard mode you chose. But it resets the position of the matrix and only applies rotation.
When you use the billboard_use_position flag, the position is also being applied (or, well, not being reset) when calculating the matrix that will be multiplied into the world matrix of the mesh. You can see the code differences here if you are interested:

Babylon.js/transformNode.ts at master · BabylonJS/Babylon.js (github.com)

1 Like

I checked the source code:

BILLBOARDMODE_NONE = 0;
BILLBOARDMODE_ALL = 7;
BILLBOARDMODE_USE_POSITION = 128;
BILLBOARDMODE_NONE  ==  BILLBOARDMODE_ALL & BILLBOARDMODE_USE_POSITION 

7&128 = 0;
The final result is BILLBOARDMODE_ NONE;
Look at my example. The result I want is that the camera icon is always facing the camera.
So the result of your code example just now is wrong.
The case is linked as follows:
https://playground.babylonjs.com/#S55F1P#2

Sure, i’ll be able to go over it and see what’s up later. It is definitely the billboard mode, that is being assigned to the parent transformation node. pass it to the sphere itself and it works:

Scaling bug of billboardMode mode | Babylon.js Playground (babylonjs.com)

https://playground.babylonjs.com/#S55F1P#4
What about this conversion? There seems to be a problem.

Again, if you apply the billboard mode to the mesh and not the transform node it works:

Test billboards billboardMode mode | Babylon.js Playground (babylonjs.com)

The reason why I want to do BILLBOARDMODE at the parent level_ ALL, to deal with the offset of children. The icon is always on the right at a fixed distance, which is what I want. This is why I want to set BILLBOARDMODE at the parent level_ Reason for ALL. Then, problems will arise

https://playground.babylonjs.com/#S55F1P#6
Open and comment 53 lines to test the effect

In your example, the mesh position of the icon is not correct, and it is offset a little upward

But it our the same with scaling 1, or am i missing something?

It is possible that some change caused an issue here, as you mentioned in another thread. I’ll look into that later today

CC @Cedric

See the effect:

textMesh.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL;

3453427

 textMesh.billboardMode = BABYLON.Mesh.BILLBOARDMODE_NONE;

The above are two ways to show the effect.

Pg is as follows:
https://playground.babylonjs.com/#S55F1P#7
Open and comment line 43 for demonstration.
So I think BILLBOARDMODE_ ALL affects location.

Is it possible that this pr is involved?This type of display is ok before he submits the pr
https://github.com/BabylonJS/Babylon.js/pull/12984

Please check the different presentations between the two versions:

This pg address test:
https://playground.babylonjs.com/#S55F1P
@RaananW @Cedric

cross thread with BillboardMode rotation bug - #4 by Cedric

1 Like
6 Likes