pivotMatrix and BILLBOARDMODE_ALL

Hi,

I’m in migration 3.2 to 4.1
But there is an issue.

Using a mesh for scalable background,
its billboardMode is BILLBOARDMODE_ALL
and pivotMatrix is set by its texture height half for bottom alignment.

I guess it should stick the ground. But it shows not y position correctly.

https://playground.babylonjs.com/#854CEJ

Please help.

Thanks.

Hiya KY! Good to see you again.

If you change line 33 false… into true… does that fix problem? Maybe try that? shrug :slight_smile:

There were some framework changes done… with that parameter.

Setting false to true does not affect translation. :slightly_frowning_face:

I want to fix the plane’s bottom by the ground’s edge.

It works on v3.3.

Ahh, ok, perhaps plane.billboardMode = BABYLON.Mesh.BILLBOARDMODE_USE_POSITION ?

https://playground.babylonjs.com/#854CEJ#1

That’s the first time I have ever used use_position. For me, it does the same thing a NO billboard (same as removing line 34)

https://playground.babylonjs.com/#854CEJ#2

In that one… I removed pivot matrix line AND billboard line… and just parented the plane to the ground, and then adjusted plane position. shrug (goofing around)

Sorry, It’s not what I wanted. :slightly_frowning_face:

You can check the difference by changing version 3.3 and the latest with the same code.

3.3
스크린샷 2020-04-06 오후 7.48.53

latest
스크린샷 2020-04-06 오후 7.48.30

Yep, good catch. Definitely a backwords-compat difference. I will study issue and maybe other helpers will have more ideas.

Other helpers… use original playground… Babylon.js Playground and switch versions from latest… to 3.3… to see issue (identical to KY’s pictures). hmm.

Version 4.03 has same problem, so… difference happened between 3.3 and 4.03, I suppose. (duh, Wingy) :slight_smile:

1 Like

Well why the new version is wrong? Can you explain why?

Hi DK, good to see you, thx for visit. Not necessarily wrong… but different. See pictures.

OR… Babylon.js Playground … switch from latest to any older version.

See red plane positioned differently? One has red plane at back edge of ground. Other has red plane NOT at back edge, but instead -z forward (toward cam) somewhat.

Same seen in FF esr or g-chrome.

Yeah I saw but as we fixed the way the billboard was computed I feel like the new version is the correct one :slight_smile:

You see the red plane a little “before” the ground because your camera look a little downward.

If you camera is looking straight ahead (camera.y == target.y), it is ok:

https://playground.babylonjs.com/#854CEJ#3

Note that in 3.3 the red plane does not stick to the ground, it goes behind:

I have only rotated from the starting point to take this screenshot, to show that the red plane does not stop right at the ground but goes below.

Hi, Evgeni
Actually, I’m using like below.

plane.setPivotMatrix(BABYLON.Matrix.Translation(0, 3, 0), false);
plane.position.z = 3;

https://playground.babylonjs.com/#854CEJ#5

It works as my thought on 3.3. but not the latest version.
The later version shows a slight difference of y position by a camera angle.

As @Deltakosh said, the differences most probably come from the fact the code as been fixed since 3.3.