Camera Movments

Has anyone already developed moving the camera just by clicking on buttons?

  • Onclick or touch UI button A move camera to POI 1
  • OnClick or Touch UI button B move camera to POI 8
  • OnClick or Touch UI Button C move camera to POI 50

  • I don’t understand how to do this

THANKS

This is React example.


const onClickBtn = (pos: Cartesian3) => {
const veiwer = this.viewer;

viewer.camera.flyToBoundingSphere(new BoundingSphere(pos, 2));
};

<button onClick={() => onClickBtn(pos1)} >A
<button onClick={() => onClickBtn(pos8)} >B
<button onClick={() => onClickBtn(pos50)} >C

Level 7 of the Cesium for Unity Samples project demonstrates flying to different location when number keys are pressed. If you’re not sure how to create UI buttons in Unity, I suspect you can find plenty of tutorials on that subject.

Hi ZhefengJin, thank you for your reply.
I don’t know how to translate this in Unity but I’ll try to understand it.

Cheers

Hi Kevin,
I saw it but I don’t see how to implement it on a tablet…

Thx

The Cesium part will be no different on a tablet from anywhere else. If you’re struggling with the Unity UI side, I suggest you ask the question in a more general Unity forum.