# The issue of rotation conversion

**URL:** <https://community.cesium.com/t/the-issue-of-rotation-conversion/28220>\
**Category:** Cesium for Unity\
**Created:** [November 21, 2023, 8:39am UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220 "2023-11-21T08:39:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liuwenkai](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/liuwenkai/32/14000_2.png) [@liuwenkai](https://community.cesium.com/u/liuwenkai)\
**Post date:** [November 21, 2023, 8:39am UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220/1 "2023-11-21T08:39:31Z")

</div>

Hello, how can I convert rotation in Unity to rotation in Cesium? How do rotations in Cesium and Unity be converted?

---

<div class="post-metadata">

**Author:** ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)\
**Post date:** [November 21, 2023, 6:03pm UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220/2 "2023-11-21T18:03:46Z")

</div>

Hi @liuwenkai,

it depends on what form you want your rotations in, and what you’re trying to rotate. Currently, there are two methods in `CesiumGeoreference` that convert a `double3` direction between Earth-Centered Earth-Fixed (ECEF) and Unity coordinates:

- `TransformUnityDirectionToEarthCenteredEarthFixed`
- `TransformEarthCenteredEarthFixedDirectionToUnity`

Additionally, a `CesiumGlobeAnchor` can interpret an object’s local rotation relative to the globe. There is a `rotationEastUpNorth` property on a `CesiumGlobeAnchor` that lets you retrieve the rotation in East-Up-North coordinates. There is also a `rotationGlobeFixed` property that lets you retrieve the rotation from the game object’s local coordinate system to the ECEF coordinate system.

---

<div class="post-metadata">

**Author:** ![liuwenkai](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/liuwenkai/32/14000_2.png) [@liuwenkai](https://community.cesium.com/u/liuwenkai)\
**Post date:** [November 22, 2023, 1:29am UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220/3 "2023-11-22T01:29:59Z")

</div>

How to achieve the same effect as the Rotation (East Up North) attribute in the CesiumGlobeAnchor script?

---

<div class="post-metadata">

**Author:** ![liuwenkai](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/liuwenkai/32/14000_2.png) [@liuwenkai](https://community.cesium.com/u/liuwenkai)\
**Post date:** [November 22, 2023, 2:43am UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220/4 "2023-11-22T02:43:25Z")

</div>

Assuming you know the longitude, latitude, and height of a game object, convert it into the coordinates used by Unity. I want to set the rotation of this game object, using Unity’s Rotation to achieve the same effect as adding the Rotation (East Up North) attribute in the CesiumGlobeAnchor script. Assuming that the Rotation (East Up North) in the CesiumGlobeAnchor script is (45,10,0), how can I convert (45,10,0) to the Rotation in Unity?

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [November 28, 2023, 8:58am UTC](https://community.cesium.com/t/the-issue-of-rotation-conversion/28220/5 "2023-11-28T08:58:43Z")

</div>

There’s no simple way to do what you’re describing without using a GlobeAnchor. You could trace through the source to see how the math works:

> <https://github.com/CesiumGS/cesium-unity/blob/v1.6.4/native~/Runtime/src/CesiumGlobeAnchorImpl.cpp#L171>

If you can’t attach a globe anchor to your object for some reason (we’d be interested in learning why not), you could create a temporary GameObject with no visual representation at the same location with a CesiumGlobeAnchor, set its rotationEastUpNorth, then apply the Transform to the original game object.
