# Mesh and Camera direction

**URL:** <https://forum.babylonjs.com/t/mesh-and-camera-direction/26683>\
**Category:** Questions\
**Created:** [January 13, 2022, 1:07am UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683 "2022-01-13T01:07:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)\
**Post date:** [January 13, 2022, 1:07am UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/1 "2022-01-13T01:07:06Z")

</div>

How can I know what direction a mesh facing? and if the mesh and the camera are facing the same 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:** [January 13, 2022, 3:43pm UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/2 "2022-01-13T15:43:56Z")

</div>

If you consider that by default the mesh is facing (0,0,1) then finding the current direction is simply about transforming (0,0,1) by mesh.getWorldMatrix()

For the camera you should be able to use camera.forwardDirection (if my memory serves as I’m on my phone)

---

<div class="post-metadata">

**Author:** ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)\
**Post date:** [January 14, 2022, 4:07am UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/3 "2022-01-14T04:07:51Z")

</div>

I think camera.getDirection(Vector3.Forward() is what you mean, right?

---

<div class="post-metadata">

**Author:** ![pigga](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pigga](https://forum.babylonjs.com/u/pigga)\
**Post date:** [January 14, 2022, 5:15am UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/4 "2022-01-14T05:15:20Z")

</div>

Can you give me more detail about what you mean here? “finding the current direction is simply about transforming (0,0,1) by mesh.getWorldMatrix()”? I think mesh.getWorldMatrix() returns matrix? Sorry, just new to babylon if it’s an easy question

---

<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:** [January 14, 2022, 4:24pm UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/5 "2022-01-14T16:24:39Z")

</div>

Yes 🙂

---

<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:** [January 14, 2022, 4:25pm UTC](https://forum.babylonjs.com/t/mesh-and-camera-direction/26683/6 "2022-01-14T16:25:34Z")

</div>

It is not really babylon but more matrix math:

for your mesh:

```auto
var direction = BABYLON.Vector3.TransformNormal(new BABYLON.Vector3(0, 0, 1), mesh.getWorldMatrix());

```
