-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera Controls for Navigation Widget #4
base: widgets-gsoc-2013
Are you sure you want to change the base?
Camera Controls for Navigation Widget #4
Conversation
zoom3D(object); | ||
} | ||
|
||
NavigationViewModel.prototype.update = function(mode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ravi, try adding some code here at the top of update
to cause the zoom ring pointer to go back home:
if (!this.zoomRingDragging) {
if (Math.abs(this.zoomRingAngle) > CesiumMath.EPSILON3) {
this.zoomRingAngle *= 0.9;
} else {
this.zoomRingAngle = 0;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above is frame-rate-dependent which might mean it bounces back too slowly on low-FPS systems. The code could be upgraded by computing the number of milliseconds since the last call to update(), and replace the 3rd line above with:
this.zoomRingAngle *= Math.pow(0.994, millisecondsSinceLastUpdate);
Of course don't update if number of milliseconds is zero, and clamp the max value of milliseconds to 5000 or so. You can adjust the constant 0.994
to find a speed that 'feels' nice (but this is a number I've used on other projects before).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can get why this is required but I am not sure how we can track milliseconds
. Can you please elaborate on the same?
var camera = object._cameraController._camera; | ||
var ellipsoid = object._ellipsoid; | ||
|
||
var height = ellipsoid.cartesianToCartographic(camera.position).height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emackey
This returns an ambiguous value on the first call after clicking on the orbit line in simple.czml
. A very large negative value is returned however a positive value is expected. The negative value messes up with the normal functioning of the camera.
I already tried to figure out the problem but couldn't. It would really help if you could look into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change camera.position
to camera.getPositionWC()
. When the camera is following an object, its position is only a few kilometers away. You need getPositionWC()
to convert that small number to world coordinates, otherwise it thinks you're near the center of the Earth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case when we Zoom In.. It crosses the satellite being tracked and makes it disappear which shouldn't be happening I guess. The reason for this is that it thinks, it still has a lot of space to zoom in. Is there a way to find out the distance between the camera and the satellite being tracked? I think this should solve the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bagnell can you take a look at this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is ellipsoid
? If the camera isn't following an object, it should probably be Ellipsoid.WGS84
. If it is following an object, it should be Ellipsoid.UNIT_SPHERE
.
Conflicts: Source/Widgets/Viewer/viewerDynamicObjectMixin.js
Navigation camera - conflict resolution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.