# Rotation calculation

**URL:** <https://forums.unrealengine.com/t/rotation-calculation/459309>\
**Category:** Community & Industry Discussion\
**Tags:** math, rotator, unreal-engine, UE4, question\
**Created:** [December 10, 2019, 3:10am UTC](https://forums.unrealengine.com/t/rotation-calculation/459309 "2019-12-10T03:10:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mattlauk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mattlauk](https://forums.unrealengine.com/u/Mattlauk)\
**Post date:** [December 10, 2019, 3:10am UTC](https://forums.unrealengine.com/t/rotation-calculation/459309/1 "2019-12-10T03:10:26Z")

</div>

I have a player that can rotate in all axis’. This player can grab objects via a PhysicsHandle and rotate them on all axis’ as well. However, I want the object to always rotate the same way relative to the player. For example, if the player presses the ‘home’ key, the object will always appear to rotate “away” from the player. I can’t seem to nail down the math behind this and google hasn’t been kind. Any suggestions?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [December 10, 2019, 9:57am UTC](https://forums.unrealengine.com/t/rotation-calculation/459309/2 "2019-12-10T09:57:54Z")

</div>

You can try getting Camera/Player right vector and rotate the object around it. It’s for rotating “away”. same with Forward vector. And Z is probably always the same, so no problems there.

---

<div class="post-metadata">

**Author:** ![Mattlauk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mattlauk](https://forums.unrealengine.com/u/Mattlauk)\
**Post date:** [December 12, 2019, 1:43am UTC](https://forums.unrealengine.com/t/rotation-calculation/459309/3 "2019-12-12T01:43:41Z")

</div>

I don’t know why but this caused a light bulb to go off in my head. Thanks.

---

<div class="post-metadata">

**Author:** ![Mattlauk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mattlauk](https://forums.unrealengine.com/u/Mattlauk)\
**Post date:** [December 12, 2019, 1:45am UTC](https://forums.unrealengine.com/t/rotation-calculation/459309/4 "2019-12-12T01:45:23Z")

</div>

Turer’s comment caused a light bulb to go off in m head. Thanks.

 ![293779-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/8/0a8d367c3a40c68a02539ddca36391d54c0d9eb7.jpeg)
