# \[Bug Report\] Terrain UpsideDown

**URL:** <https://community.cesium.com/t/bug-report-terrain-upsidedown/6048>\
**Category:** CesiumJS\
**Created:** [September 15, 2017, 6:03am UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048 "2017-09-15T06:03:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shyoo](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shyoo](https://community.cesium.com/u/shyoo)\
**Post date:** [September 15, 2017, 6:03am UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/1 "2017-09-15T06:03:02Z")

</div>

Hi I think, I found a bug

After Camera related PR Merge

**([https://github.com/AnalyticalGraphicsInc/cesium/pull/5603](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603)\*\*\*\*) : Maintain camera heading, pitch, and roll on zoom**

Camera controller allow to turn over the ground.

This can happen if you drag the ground when the terrain update is not over.

[![](https://lh3.googleusercontent.com/-kAtGEICzl4I/WbtscBTu3yI/AAAAAAAAraI/aagiKLKDNQAw4PwpPHGVB54Jis7h6QUOgCLcBGAs/s320/upsidedown.png)](https://lh3.googleusercontent.com/-kAtGEICzl4I/WbtscBTu3yI/AAAAAAAAraI/aagiKLKDNQAw4PwpPHGVB54Jis7h6QUOgCLcBGAs/s1600/upsidedown.png)

please review it

Thanks cesium team

shyoo.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [September 18, 2017, 8:45pm UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/2 "2017-09-18T20:45:17Z")

</div>

Thanks for tracking this down!

I opened a new GitHub issue ([https://github.com/AnalyticalGraphicsInc/cesium/issues/5837](https://github.com/AnalyticalGraphicsInc/cesium/issues/5837)) to track, and there is some discussion on that Pull Request if you have any more input.

Thanks again!

Gabby

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [September 19, 2017, 9:02pm UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/3 "2017-09-19T21:02:50Z")

</div>

So this may not be a bug after all- In the case it might be intended behavior. See[this pull request](https://github.com/AnalyticalGraphicsInc/cesium/pull/4105)where we allow the camera to go underground while the terrain is still loading. If you think you’re still seeing a bug, let us know.

Thanks,

Gabby

---

<div class="post-metadata">

**Author:** ![shyoo](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shyoo](https://community.cesium.com/u/shyoo)\
**Post date:** [September 20, 2017, 11:49pm UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/4 "2017-09-20T23:49:31Z")

</div>

I'll look further into it and see if there's any solution.

---

<div class="post-metadata">

**Author:** ![shyoo](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@shyoo](https://community.cesium.com/u/shyoo)\
**Post date:** [January 15, 2018, 1:33am UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/5 "2018-01-15T01:33:58Z")

</div>

After Camera related PR Merge([https://github.com/AnalyticalGraphicsInc/cesium/pull/5603](https://github.com/AnalyticalGraphicsInc/cesium/pull/5603)) : Maintain camera heading, pitch, and roll on zoom

In handleZoom function(in Scene\ScreenSpaceCameraController.js)

there are two setView calls : camera.setView(scratchZoomViewOptions)

And it makes terrainAdjustment skip(camera.\_suspendTerrainAdjustment = true) at camera.prototype.setView

So I modified handleZoom function:

//cancel camera suspendTerrainAdjustment right after setView calls

function handleZoom(object, startPosition, movement, zoomFactor, distanceMeasure, unitPositionDotDirection) {

…

camera.setView(scratchZoomViewOptions)

camera.\_suspendTerrainAdjustment = false; //added

…

…

camera.setView(scratchZoomViewOptions)

camera.\_suspendTerrainAdjustment = false; //added

…

}

It works for me.

It’s not perfect, but it’s enough for me until future camera improvements.

I hope it can help someone.

shyoo.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [January 16, 2018, 3:26pm UTC](https://community.cesium.com/t/bug-report-terrain-upsidedown/6048/6 "2018-01-16T15:26:21Z")

</div>

Hi Shyoo,

Thanks for the workaround, I’m g;ad it works for your purposes for now! We have a [PR open](https://github.com/AnalyticalGraphicsInc/cesium/pull/6012) from a community member that accomplishes something similar, but we’re not 100% sure it’s the right approach. We’ll hopefully reach consensus on the best path forward to fix this soon.

Thanks,

Gabby
