# Rotate component in it's local space toward a point in world

**URL:** <https://forums.unrealengine.com/t/rotate-component-in-its-local-space-toward-a-point-in-world/1907388>\
**Category:** Programming & Scripting\
**Tags:** rotation, rotation-direction, unreal-engine, rotate, question, CPP, vector-math\
**Created:** [June 18, 2024, 7:12am UTC](https://forums.unrealengine.com/t/rotate-component-in-its-local-space-toward-a-point-in-world/1907388 "2024-06-18T07:12:29Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [June 18, 2024, 11:33am UTC](https://forums.unrealengine.com/t/rotate-component-in-its-local-space-toward-a-point-in-world/1907388/16 "2024-06-18T11:33:09Z")

</div>

> Rotate component in it’s local space toward a point in world

See if this is what you’re looking for:

> [@Restrict Pawn's Rotation](https://forums.unrealengine.com/t/restrict-pawns-rotation/487856/3):
>
> Have a look at this one: Script to copy: [[Image from Gyazo]](https://gyazo.com/07facc8d174c94dd6103a641878c6929) Essentially, Dot Product is an answer to most angular issues. The yellow arrow indicates the turret’s front. Oh, and a TL is probably not the way to go about it unless you’re after something truly specific / unique / inflexible. Does not mesh well with target tracking in my head.

You must transform direction to / from local space. Ignore the interps and clamps, ofc. It’s a bit dated, today I’d at least `slerp` directions.

---

_[View the full topic](https://forums.unrealengine.com/t/rotate-component-in-its-local-space-toward-a-point-in-world/1907388)._
