how to set camera in the car?

Hey there,

I have a car that is moving,I want to set the camera in the cab,and follow the car.
I tried using ‘trackEntity’ ,but the perspective is outside the car.

And I found a demo:GEFS Online can achieve this effect

how can I do that?

Thanks,

-Zhang

You can use Camera.setView() along with a destination (where do you want the camera to be) and an orientation. The destination would just be the same as the car’s (maybe with a bit of an offset) and the orientation would also be the same as the car’s (although I found I needed to add PI/2 to the entity’s heading).

Hi there,

Check out this thread on the same subject: https://groups.google.com/forum/?hl=en#!searchin/cesium-dev/follow$20camera|sort:date/cesium-dev/-mDNh2qlTZQ/b8HXOyNPBQAJ

Hope that helps,

  • Rachel

Thank you for your response!

在 2017年7月19日星期三 UTC+8下午10:01:58,Rachel Hwang写道:

Thank you so much,I used setView,it can put in the car,but can’t follow the car to move
在 2017年7月19日星期三 UTC+8下午8:33:56,ene…@seas.upenn.edu写道:

Try setting up an onTick() listener and updating the camera every clock tick. This creates a really smooth view.