Skip to content
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

Open
wants to merge 43 commits into
base: widgets-gsoc-2013
Choose a base branch
from

Conversation

raviagrwl420
Copy link

No description provided.

zoom3D(object);
}

NavigationViewModel.prototype.update = function(mode) {
Copy link
Owner

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;
            }
        }

Copy link
Owner

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).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emackey

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;
Copy link
Author

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.

Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

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?

Copy link

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.

Copy link

@Kenianayelivalderamos Kenianayelivalderamos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- >~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants