# pivotMatrix and BILLBOARDMODE\_ALL

**URL:** <https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752>\
**Category:** Questions\
**Created:** [April 6, 2020, 8:26am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752 "2020-04-06T08:26:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaude\_Yu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/klaude_yu/32/1833_2.png) [@Klaude\_Yu](https://forum.babylonjs.com/u/Klaude_Yu)\
**Post date:** [April 6, 2020, 8:26am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/1 "2020-04-06T08:26:25Z")

</div>

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](https://playground.babylonjs.com/#854CEJ)

Please help.

Thanks.

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [April 6, 2020, 10:18am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/2 "2020-04-06T10:18:20Z")

</div>

Hiya KY! Good to see you again.

If you change line 33 _false_… into _true_… does that fix problem? Maybe try that? shrug 🙂

There were some framework changes done… with that parameter.

---

<div class="post-metadata">

**Author:** ![Klaude\_Yu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/klaude_yu/32/1833_2.png) [@Klaude\_Yu](https://forum.babylonjs.com/u/Klaude_Yu)\
**Post date:** [April 6, 2020, 10:38am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/3 "2020-04-06T10:38:51Z")

</div>

Setting false to true does not affect translation. 🙁

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

It works on v3.3.

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [April 6, 2020, 10:42am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/4 "2020-04-06T10:42:24Z")

</div>

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

[https://playground.babylonjs.com/#854CEJ#1](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](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)

---

<div class="post-metadata">

**Author:** ![Klaude\_Yu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/klaude_yu/32/1833_2.png) [@Klaude\_Yu](https://forum.babylonjs.com/u/Klaude_Yu)\
**Post date:** [April 6, 2020, 10:54am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/5 "2020-04-06T10:54:29Z")

</div>

Sorry, It’s not what I wanted. 🙁

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](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/e/e931888d02fb5dbad28d59eb663a512670322350.png)

latest  
 ![스크린샷 2020-04-06 오후 7.48.30](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/3/301aaec140fc182cc44bbf14563e9e5617406796.png)

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [April 6, 2020, 11:04am UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/6 "2020-04-06T11:04:27Z")

</div>

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](https://playground.babylonjs.com/#854CEJ) 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) 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 6, 2020, 3:55pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/7 "2020-04-06T15:55:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [April 6, 2020, 4:56pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/8 "2020-04-06T16:56:12Z")

</div>

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

OR… [Babylon.js Playground](https://playground.babylonjs.com/#854CEJ) … 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.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 6, 2020, 5:08pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/9 "2020-04-06T17:08:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 6, 2020, 5:22pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/10 "2020-04-06T17:22:57Z")

</div>

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](https://playground.babylonjs.com/#854CEJ#3)

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/a/a815a1afae82e376148b98b36a2a13f5e1476664.png)

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.

---

<div class="post-metadata">

**Author:** ![Klaude\_Yu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/klaude_yu/32/1833_2.png) [@Klaude\_Yu](https://forum.babylonjs.com/u/Klaude_Yu)\
**Post date:** [April 6, 2020, 6:26pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/11 "2020-04-06T18:26:41Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 6, 2020, 7:31pm UTC](https://forum.babylonjs.com/t/pivotmatrix-and-billboardmode-all/9752/12 "2020-04-06T19:31:46Z")

</div>

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