# Make mesh align in the same direction as another mesh

**URL:** <https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223>\
**Category:** Questions\
**Created:** [September 16, 2020, 1:58pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223 "2020-09-16T13:58:57Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 18, 2020, 5:56pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/21 "2020-09-18T17:56:10Z")

</div>

Sure. I will try these out. But then again this may solve the position but not the scale and orientation

---

<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:** [September 18, 2020, 6:57pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/22 "2020-09-18T18:57:55Z")

</div>

let’s fix it step by step 😃

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 18, 2020, 7:19pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/23 "2020-09-18T19:19:51Z")

</div>

@Deltakosh how does this look like?  
[https://playground.babylonjs.com/#B6XF7C#3](https://playground.babylonjs.com/#B6XF7C#3)

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 18, 2020, 7:37pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/24 "2020-09-18T19:37:27Z")

</div>

[https://playground.babylonjs.com/#B6XF7C#4](https://playground.babylonjs.com/#B6XF7C#4) this takes care of scale imo @Deltakosh

---

<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:** [September 18, 2020, 7:37pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/25 "2020-09-18T19:37:39Z")

</div>

this is really great!!  
for scaling, I could recommend to compare the distance between min and max of their respective bounding boxes and then scale accordingly

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 18, 2020, 7:39pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/26 "2020-09-18T19:39:11Z")

</div>

Yeah that’s what I did [https://playground.babylonjs.com/#B6XF7C#4](https://playground.babylonjs.com/#B6XF7C#4)  
@Deltakosh  
what do you think about this?  
Also for the direction do you have any ideas?

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 18, 2020, 9:19pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/27 "2020-09-18T21:19:00Z")

</div>

@Deltakoshi think it should be possible to find the normal corresponding to the point _**(positions[5211], positions[5212], positions[5213])**_ i.e. the center of forehead

The normals of this point can then be used to obtain the direction in which the hat mesh is supposed to point.

How to make a mesh point in a known direction?

---

<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:** [September 21, 2020, 3:41pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/28 "2020-09-21T15:41:18Z")

</div>

You can do mesh.lookAt for that 🙂

---

<div class="post-metadata">

**Author:** ![Noob007](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Noob007](https://forum.babylonjs.com/u/Noob007)\
**Post date:** [September 22, 2020, 10:32pm UTC](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223/29 "2020-09-22T22:32:56Z")

</div>

Thanks for consistently nudging me in the right direction @Deltakosh  
[https://playground.babylonjs.com/#B6XF7C#5](https://playground.babylonjs.com/#B6XF7C#5) Any suggestions on how to improve from here?

[Previous page](https://forum.babylonjs.com/t/make-mesh-align-in-the-same-direction-as-another-mesh/14223.md?page=1)
