# Combine rotations so item always faces camera... but also faces the bottom of the screen

**URL:** <https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965>\
**Category:** Questions\
**Tags:** camera, quaternion\
**Created:** [June 1, 2022, 2:06pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965 "2022-06-01T14:06:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 2:06pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/1 "2022-06-01T14:06:05Z")

</div>

The goal is to get a hotspot that always faces the camera… but as its an info icon, the request was to get the i to always face the bottom of the screen (like text). Ive been pounding my head against the wall for days trying to get the math right to combine the rotations to get this correct with no luck. Wondering if anyone with better math chops can help out? Attached a playground below.

> **[Babylon.js Playground](https://playground.babylonjs.com/#NQGD89)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 1, 2022, 2:18pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/2 "2022-06-01T14:18:20Z")

</div>

> [@jekelija](#):
>
> Ive been pounding my head against the wall for days trying to get the math right

You shouldn’t do that. It’s not good for your health 😉  
I would rather use the 2D GUI for that. Guaranteed without damage to your head.  
May be have a closer look at [this section of the doc](https://doc.babylonjs.com/divingDeeper/gui/gui#tracking-positions)  
If still struggling let us know, preferably before you get a brain damage 🧠 😉

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 2:28pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/3 "2022-06-01T14:28:18Z")

</div>

There are some other reasons we are using 3d (there are some animations on hover that look all nice and sparkly that require 3d). Haha trust me, i wish we could use 2d for this.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 1, 2022, 2:30pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/4 "2022-06-01T14:30:16Z")

</div>

> [@jekelija](#):
>
> some animations on hover that look all nice and sparkly that require 3d

I believe you but I wonder what this is. Could you share this with us in a PG so we can get a complete understanding of it?

Edit: And also, can you confirm the arcRotateCamera is the camera (and only camera) you need for this?  
Because, it’s clearly not the easiest to tweak 😉

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 2:50pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/5 "2022-06-01T14:50:24Z")

</div>

Arc rotate camera is the only camera i need for this. Basically the hotspot does a little waggle and dance that shows that it has depth

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 1, 2022, 2:52pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/6 "2022-06-01T14:52:51Z")

</div>

And then of course, a wiggling camera would not do the same effect, yes? If not for a PG, could you make a small video of the animation effect?

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 2:55pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/7 "2022-06-01T14:55:09Z")

</div>

I can try to do a PG in a bit, i dont have a video, just basically that description. Would a 2d-gui ever have depth?

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 1, 2022, 2:58pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/8 "2022-06-01T14:58:08Z")

</div>

No, 2D is 2D. However, there’s also the 3D GUI and there’s also a combination of both.  
Fact is the arcRotateCamera (as you may have noticed while doing dangerous things with your head against walls 😉 will not make it easy at all to handle this. So any alternate solution we could find is worth considering.

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 3:01pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/9 "2022-06-01T15:01:38Z")

</div>

Ah gotcha. Looking through the documentation now, looks like mesh button 3d may be what im looking for?

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 1, 2022, 3:02pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/10 "2022-06-01T15:02:27Z")

</div>

May be. Again, hard to help without a PG or even a visual.

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 6:12pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/11 "2022-06-01T18:12:11Z")

</div>

I have a visual and a PG for what i am trying to accomplish. I want it to face the camera but always face up/down. Mesh Button 3d doesnt seem to help with that. I think even if i use MeshButton3d, i would still need the same quaternion multiply

---

<div class="post-metadata">

**Author:** ![jekelija](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jekelija/32/5458_2.png) [@jekelija](https://forum.babylonjs.com/u/jekelija)\
**Post date:** [June 1, 2022, 9:34pm UTC](https://forum.babylonjs.com/t/combine-rotations-so-item-always-faces-camera-but-also-faces-the-bottom-of-the-screen/30965/12 "2022-06-01T21:34:38Z")

</div>

Solved it! needed a secondary twist rotation based on the bottom of the screen position: [https://playground.babylonjs.com/#NQGD89#2](https://playground.babylonjs.com/#NQGD89#2)
