# How to stay attached to the earth's surface?

**URL:** <https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530>\
**Category:** Cesium for Unreal\
**Created:** [March 2, 2022, 7:21am UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530 "2022-03-02T07:21:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![http3w](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/http3w/32/3476_2.png) [@http3w](https://community.cesium.com/u/http3w)\
**Post date:** [March 2, 2022, 7:21am UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/1 "2022-03-02T07:21:13Z")

</div>

Hi, When I want to move the object, the object snaps to the earth’s surface.How do I get the altitude of a position on the earth?

---

<div class="post-metadata">

**Author:** ![agallegos](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/agallegos/32/4464_2.png) [@agallegos](https://community.cesium.com/u/agallegos)\
**Post date:** [March 3, 2022, 11:01pm UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/2 "2022-03-03T23:01:04Z")

</div>

Hi @http3w,

If possible, could you post a video of the issue?

If you need to get the altitude of a position on earth, this comment might be helpful: [The height of the sea is not 0 - #8 by Kevin\_Ring](https://community.cesium.com/t/the-height-of-the-sea-is-not-0/14220/8?u)

---

<div class="post-metadata">

**Author:** ![http3w](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/http3w/32/3476_2.png) [@http3w](https://community.cesium.com/u/http3w)\
**Post date:** [March 7, 2022, 1:49am UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/5 "2022-03-07T01:49:42Z")

</div>

Thank you for your reply! @agallegos

 ![test.PNG](https://global.discourse-cdn.com/cesium/original/2X/c/cbb75796bb0be3ec2e7ea0b73e1e88ec522926a9.jpeg)  
I need to get the altitude of positions on spline point.The #[online EGM96 calculator](https://geographiclib.sourceforge.io/cgi-bin/GeoidEval) can’t meet my requirements.  
I used this solution: # [Stick to the ground](https://community.cesium.com/t/stick-to-the-ground/13576) , but performance will degrade and this not work if the spline is far away from the player, and the tiles it is passing over are not loaded.

---

<div class="post-metadata">

**Author:** ![agallegos](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/agallegos/32/4464_2.png) [@agallegos](https://community.cesium.com/u/agallegos)\
**Post date:** [March 8, 2022, 5:42pm UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/6 "2022-03-08T17:42:11Z")

</div>

Hi @http3w,

If you’re using a spline and have already defined their position on the globe, you should be able to access the location of a spline point during play and convert it from UE coordinates to longitude/latitude/height coordinates.

If I’m understanding your project correctly, you may want to try the following:

1. [Get the location at a spline point.](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Spline/GetLocationatSplinePoint/) You’ll want to switch the Coordinate Space to World instead of Local. There are also a lot of other [useful spline functions](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Spline/) that may be better suited for your situation.
2. Connect the output of your get location node to a **InaccurateTransformUnrealToLongitudeLatitudeHeight** node. Connect the level’s georeference actor to the Target pin of the node.
3. The Z value of the output of the coordinate transform node should contain the altitude at that spline point. You can use a Break Vector node to access only the altitude (stored as the vector’s Z value.)  
 ![image](https://global.discourse-cdn.com/cesium/original/2X/8/8e0a5fedfa0fe6424bdfaba4b4f626b58d68196a.png)

This solution might not be as accurate if the player is far away from the origin, but should work even if the tiles around it are not loaded. I would also guess it would be better for performance than the Line Trace solution you explored.

---

<div class="post-metadata">

**Author:** ![http3w](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/http3w/32/3476_2.png) [@http3w](https://community.cesium.com/u/http3w)\
**Post date:** [March 11, 2022, 4:07am UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/7 "2022-03-11T04:07:54Z")

</div>

thanks, I will try to do so

---

<div class="post-metadata">

**Author:** ![http3w](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/http3w/32/3476_2.png) [@http3w](https://community.cesium.com/u/http3w)\
**Post date:** [March 18, 2022, 8:57am UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/8 "2022-03-18T08:57:40Z")

</div>

Hi @agallegos I want to get the altitude through longitude and latitude,So this doesn’t solve my problem

---

<div class="post-metadata">

**Author:** ![agallegos](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/agallegos/32/4464_2.png) [@agallegos](https://community.cesium.com/u/agallegos)\
**Post date:** [March 21, 2022, 3:37pm UTC](https://community.cesium.com/t/how-to-stay-attached-to-the-earths-surface/17530/9 "2022-03-21T15:37:19Z")

</div>

Hi @http3w,

If you need to get the altitude from longitude and latitude, then your best bet is probably [Stick to the ground](https://community.cesium.com/t/stick-to-the-ground/13576), as you mentioned. It’s not good for performance but you can add another camera in that area and make it render to a render texture. Having the other camera should keep the tiles from unloading.

Otherwise, I don’t have any other suggestions - but if you find a method that works for you, please post it here!
