How to fix Earth axis along Y axis?

59 views
Skip to first unread message

Onkel Tem

unread,
Jan 12, 2017, 9:13:46 PM1/12/17
to cesium-dev

Is there a way to freeze Earth axis from bending left or right? I want it have the constant 0° angle relative to Y axis, no matter what I'm doing. Currently even zooming in and out makes Earth to rotate in random directions. In other words how prevent "compass arrow" from arbitrary rotations?

Hannah Pinkos

unread,
Jan 13, 2017, 10:03:12 AM1/13/17
to cesium-dev
Hello,

The easiest way to do this is with a preRender event.  Here is an example: 

var viewer = new Cesium.Viewer('cesiumContainer');
var camera = viewer.scene.camera;
viewer
.scene.preRender.addEventListener(function() {
    camera
.setView({
        orientation
: {
            heading
: 0,
            pitch
: camera.pitch,
            roll
: camera.roll
       
}
   
});
});


Best,

Hannah

Artiom Neganov

unread,
Jan 15, 2017, 6:21:33 PM1/15/17
to cesiu...@googlegroups.com
Thank you for the reply.

Is this the only code I need to get the desired behavior of the camera?

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/ZKimT0pYt80/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Onkel Tem

unread,
Jan 19, 2017, 5:37:06 AM1/19/17
to cesium-dev
Would you clarify, how to use this solution?

пятница, 13 января 2017 г., 18:03:12 UTC+3 пользователь Hannah Pinkos написал:

Hannah Pinkos

unread,
Jan 19, 2017, 9:39:56 AM1/19/17
to cesium-dev
You can insert the preRender event in the code right after you call new Cesium.Viewer to add the globe to the window.

-Hannah

王屯

unread,
Oct 20, 2017, 9:51:00 PM10/20/17
to cesium-dev

It does not seem to work. I can also rotate the global anywhere

在 2017年1月13日星期五 UTC+8下午11:03:12,Hannah Pinkos写道:

王屯

unread,
Mar 19, 2018, 1:11:23 AM3/19/18
to cesium-dev
@Onkel Tem   have you found any solution of the problem? thank


在 2017年1月13日星期五 UTC+8上午10:13:46,Onkel Tem写道:

Artiom Neganov

unread,
Mar 19, 2018, 5:36:41 PM3/19/18
to cesiu...@googlegroups.com
2018-03-19 8:11 GMT+03:00 王屯 <wangd...@gmail.com>:
@Onkel Tem   have you found any solution of the problem? thank

No :(
 


在 2017年1月13日星期五 UTC+8上午10:13:46,Onkel Tem写道:

Is there a way to freeze Earth axis from bending left or right? I want it have the constant 0° angle relative to Y axis, no matter what I'm doing. Currently even zooming in and out makes Earth to rotate in random directions. In other words how prevent "compass arrow" from arbitrary rotations?

--
Reply all
Reply to author
Forward
0 new messages