# How do I set a rotation on an object between two points? Z-axis

**URL:** <https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [April 13, 2026, 2:23am UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894 "2026-04-13T02:23:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [April 13, 2026, 2:23am UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894/1 "2026-04-13T02:23:54Z")

</div>

I am spawning an object and I want to change its rotation every spawn. I have an object with a rotation in Z = 0 forward direction. I want to change it rotation randomly in the z axis between 225 and 135.

How make a random value between two points and pop it out? For the spawn

---

<div class="post-metadata">

**Author:** ![Infant\_Zero](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/infant_zero/32/715655_2.png) [@Infant\_Zero](https://forums.unrealengine.com/u/Infant_Zero)\
**Post date:** [April 13, 2026, 2:56am UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894/2 "2026-04-13T02:56:10Z")

</div>

Something like either of these should work:

 ![Screenshot 2026-04-12 215236](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/7/2b78e954ccfcffb19181b70bfe2bc7aa4d5207b8.png)

---

<div class="post-metadata">

**Author:** ![danamaloma](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/danamaloma/32/1167197_2.png) [@danamaloma](https://forums.unrealengine.com/u/danamaloma)\
**Post date:** [April 13, 2026, 6:27am UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894/3 "2026-04-13T06:27:30Z")

</div>

To rotate an object so it faces between two points (using **Z axis / yaw** in Unreal):

### Simple way (Blueprint or C++)

Use **Find Look At Rotation** , then keep only Z:

```auto
Rotation = FindLookAtRotation(Start, Target)
NewRotation = (0, 0, Rotation.Yaw)

```

👉 This makes the object rotate **only around Z (yaw)** and ignore pitch/roll.

* * *

### In Blueprint

- Use **Find Look At Rotation**

- Break Rotator

- Make Rotator:

- Set Actor Rotation

* * *

### In C++ (example)

```auto
FRotator LookAt = UKismetMathLibrary::FindLookAtRotation(Start, Target);
FRotator YawOnly(0.f, LookAt.Yaw, 0.f);
SetActorRotation(YawOnly);

```

---

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [April 14, 2026, 12:43am UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894/4 "2026-04-14T00:43:45Z")

</div>

Yes this was what I was looking for, thank you

---

<div class="post-metadata">

**Author:** ![Infant\_Zero](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/infant_zero/32/715655_2.png) [@Infant\_Zero](https://forums.unrealengine.com/u/Infant_Zero)\
**Post date:** [April 14, 2026, 3:21pm UTC](https://forums.unrealengine.com/t/how-do-i-set-a-rotation-on-an-object-between-two-points-z-axis/2714894/5 "2026-04-14T15:21:49Z")

</div>

You’re welcome.
