I need to lock camera on an entity on cesium while the entity moving. The entity and camera should be locked to center of the screen while the map moves on the background.
A half solution I found is to use the ( viewer.trackedEntity ) e.g. viewer.trackedEntity=entity.id << this will lock the camera to current entity target while the map moves. However, the main issue here is that the ( trackedEntity) zooms in to lowest point and tilt when this feature get activated. I don't want this zoom in or tilt feature when ( trackedEntity ) do the camera lock on the entity.
I tried to do
viewer.camera.zoomTo(100) after the (viewer.trackedEntity) but this doesn't work and not even good since initially the camera will be locked to the zoom level of ( trackedEntity ) feature.
I really need some help. How can I lock an entity and unlock it to current screen position while the map is moving.
You were so helpful, the ViewFrom helped me to tweak the camera to not make it zooms in and keep the view the same as it was.
However, I want to know how can I disable that feature which when using the viewer.trackedEntity to be centered on the view.
By default when I use viewer.trackedEntity the camera view is changed and animated to make the entity on the center of the screen, is there a way to disable this feature, I want the entity to be locked to same current position without changing the camera current view.
Does the animation happen the same way regardless of how ViewFrom is set? Can you post the code you tried or a Sandcastle example of what you have so far? That’ll help me see exactly what’s going on.
If it helps. this is the function in the source code which updates the camera when a trackedEntity is set:
I'm not really sure. I really need to get rid of this animation which cause the entity to be centered from ( trackedEntity )
I have posted my simple code. Just paste it on Sandcastle. You can see I added a move feature for the entity to keep it moving and on entity selection activate the trackedEntity feature.