# 'Actor Position WS', but I need Actor Rotation WS

**URL:** <https://forums.unrealengine.com/t/actor-position-ws-but-i-need-actor-rotation-ws/363535>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [July 10, 2016, 11:42am UTC](https://forums.unrealengine.com/t/actor-position-ws-but-i-need-actor-rotation-ws/363535 "2016-07-10T11:42:49Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![neofuturelabs](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/neofuturelabs/32/1194562_2.png) [@neofuturelabs](https://forums.unrealengine.com/u/neofuturelabs)\
**Post date:** [April 28, 2023, 5:33pm UTC](https://forums.unrealengine.com/t/actor-position-ws-but-i-need-actor-rotation-ws/363535/8 "2023-04-28T17:33:04Z")

</div>

Weird that it’s showing that syntax error. You put the code directly into a Custom node in the Material Editor right? I’m on UE5.1.1 and it’s still working for me.

It also seemed to work for the guy in the other post about this:

> [@Get Actor x, y, z rotation angle in shader](https://forums.unrealengine.com/t/get-actor-x-y-z-rotation-angle-in-shader/155362/7):
>
> [mpxc](https://forums.unrealengine.com/u/mpxc) this piece of code helped me a lot, thanks! However, the Y value was wrong so I modified code to work properly (UE5.1.1) float3x3 WtoL = LWCToFloat(GetPrimitiveData(Parameters.PrimitiveId).WorldToLocal); float3 R = float3( atan2(WtoL[2].y,WtoL[2].z) \* -1.0, atan2(WtoL[2].x,WtoL[2].z), atan2(WtoL[1].x,WtoL[0].x) ); return R \< 0 ? 2 \* pi - abs(R) : R;

Note that there is an issue with the Y value calculation in my original post which he mostly resolved in the above post, although it still doesn’t seem to be perfect.

---

_[View the full topic](https://forums.unrealengine.com/t/actor-position-ws-but-i-need-actor-rotation-ws/363535)._
