2017-02-16 2 views
0

큰 도시 100k poeple가 있습니다. 중용 높이 (z 값)에서 내 지형 (지도 레이어 + 3 건물)을 보여주고 싶습니다. 내장 메커니즘을 사용하여 가능합니까?회전 및 위치에 제약 조건을 지정할 수 있습니까?

+0

은 특정 높이 아래 점점에서 카메라를 제한하려고합니까? – emackey

+0

특정보기에서 나는 땅을 낮추어야하기 때문에 아래가 잘되어야합니다. – RobertW

답변

0

시계에 걸리면 카메라가 "허용 된 영역"에 있는지 확인할 수 있습니다.

마다 똑딱이, 카메라가 올바른 위치에 있지 않은지 확인하십시오. 그렇지 않은 경우 수정하십시오.

다음은 카메라의 높이를 제한하는 예제이지만 같은 패턴을 사용하여 위치의 다른 측면을 제한 할 수도 있습니다.

샌드캐슬은 : http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=c943ebc6b2d06b9a555584cd1e3f6a97

var viewer = new Cesium.Viewer('cesiumContainer'); 

// the max height that should be allowed in meters 
var MAX_HEIGHT = 4e6; 

// each clock tick ensure the camera is in the right position 
viewer.clock.onTick.addEventListener(function() { 
    var curHeight = viewer.scene.globe.ellipsoid.cartesianToCartographic(viewer.camera.position).height; 
    var heightFromMax = curHeight - MAX_HEIGHT; 

    // if the height of the camera is above the max, move the camera forward to ensure it is lower than the max 
    if (heightFromMax > 0) { 
     viewer.scene.camera.moveForward(heightFromMax); 
     return; 
    } 
}); 
관련 문제