# Struggling with how to use LookAt without adjusting along the Yaw

**URL:** <https://forums.unrealengine.com/t/struggling-with-how-to-use-lookat-without-adjusting-along-the-yaw/1869474>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [May 23, 2024, 4:34pm UTC](https://forums.unrealengine.com/t/struggling-with-how-to-use-lookat-without-adjusting-along-the-yaw/1869474 "2024-05-23T16:34:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LockeKosta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LockeKosta](https://forums.unrealengine.com/u/LockeKosta)\
**Post date:** [May 23, 2024, 4:34pm UTC](https://forums.unrealengine.com/t/struggling-with-how-to-use-lookat-without-adjusting-along-the-yaw/1869474/1 "2024-05-23T16:34:24Z")

</div>

I’m just trying to get a character pawn to rotate towards the unit it’s attacking without factoring in the Y/yaw so it doesn’t angle up at targets that are larger than it. However I can’t get it to work for some reason.

Here’s what I have:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/4/ef408813d69ed21c7381c2420f5c570c70a0a866.png)

I can stop the yaw movement if I set it when setting the rotation but then I lose the Slerp. I’ve tried subtracting the yaw and I’ve tried limiting it when getting the lookAtRot. I can’t seem to get my character to rotate towards its target without also leaning along the Y/yaw axis.

Any assistance would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![LockeKosta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LockeKosta](https://forums.unrealengine.com/u/LockeKosta)\
**Post date:** [May 23, 2024, 5:48pm UTC](https://forums.unrealengine.com/t/struggling-with-how-to-use-lookat-without-adjusting-along-the-yaw/1869474/2 "2024-05-23T17:48:55Z")

</div>

The answer I found was to remove the Z axis from the locations used while finding the look at rotation. Forgot RotY = LocZ.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [June 22, 2024, 5:49pm UTC](https://forums.unrealengine.com/t/struggling-with-how-to-use-lookat-without-adjusting-along-the-yaw/1869474/3 "2024-06-22T17:49:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
