# Mesh lookAt Not Working If the Mesh is Parented

**URL:** <https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186>\
**Category:** Questions\
**Tags:** mesh, meshes\
**Created:** [January 8, 2023, 6:53am UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186 "2023-01-08T06:53:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael-29](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rafael-29/32/29145_2.png) [@rafael-29](https://forum.babylonjs.com/u/rafael-29)\
**Post date:** [January 8, 2023, 6:53am UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/1 "2023-01-08T06:53:23Z")

</div>

HI newbie here. I created a box and put box.lookAt( my character position). It works fine I put it in the sceneRegisterBeforeRender function so it always follows my character wherever I go. However, If I put the box parent to another player the box.lookAt() is still working but not looking at me and it looks on a different location. I hope someone knows the trick to this I think I need to make the box look at in the Global Location but I dont know how

---

<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:** [January 9, 2023, 12:38pm UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/2 "2023-01-09T12:38:33Z")

</div>

Could you setup a minimal repro in the Playground so that it’s easier for us to see what’s going on and try to find a solution?

---

<div class="post-metadata">

**Author:** ![Takemura](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/takemura/32/25836_2.png) [@Takemura](https://forum.babylonjs.com/u/Takemura)\
**Post date:** [January 9, 2023, 1:17pm UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/3 "2023-01-09T13:17:00Z")

</div>

You can use correction parameter of lookAt()-function, to take parent rotation into account:

> **[AbstractMesh | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/classes/BABYLON.AbstractMesh#lookAt)**
>
> Class used to store all common mesh properties \[API\]

I think you have to correct lookAt by invert rotation of your parent.

---

<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:** [January 9, 2023, 2:10pm UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/4 "2023-01-09T14:10:36Z")

</div>

Also, there is a `space` parameter to the `lookAt` function, so you can try to use `Space.WORLD` as `Space.LOCAL` is the default value.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 10, 2023, 2:19pm UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/5 "2023-01-10T14:19:18Z")

</div>

It’s the third topic of yours I have to ask for a playground, it would make us able to understand your problem and answer your question much faster.

---

<div class="post-metadata">

**Author:** ![derpdewp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/derpdewp/32/29245_2.png) [@derpdewp](https://forum.babylonjs.com/u/derpdewp)\
**Post date:** [January 11, 2023, 5:52am UTC](https://forum.babylonjs.com/t/mesh-lookat-not-working-if-the-mesh-is-parented/37186/6 "2023-01-11T05:52:50Z")

</div>

just wanted to jump in here and say thanks for the space suggestion. this worked like a charm

```auto
mesh.lookAt(new Vector3(1,1,1), 0, 0, 0, Space.WORLD);

```
