Zoom bug in ortho 3d?

  1. A concise explanation of the problem you’re experiencing.

When ortho 3d mode is used and we first move camera and then zoom, the zoom jumps / jitters in the beginning. For example translate view first and then zoom -out- with mouse wheel => this might end up zooming in the view.

  1. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Gist:

  1. Context. Why do you need to do this? We might know a better way to accomplish your goal.

  2. The Cesium version you’re using, your operating system and browser.

Newest sandcastle and osx + chrome.

Hello,

I wasn’t able to reproduce the jump or jitter. If you have a gif or video that may help.

You are able to override the Cesium default camera controls if you want something specific, see this Sandcastle demo and the Camera tutorial.

Thanks,

Gabby

For this one by the way: We can reproduce this still but it takes some time and precision :slight_smile:

Anyways, by commenting out the following code fixed everything for us “magically”… I am not really sure what is this code for:

Camera.prototype._adjustOrthographicFrustum = function(zooming) {

if (!(this.frustum instanceof OrthographicFrustum)) {

return;

}

if (!zooming && this._positionCartographic.height < 150000.0) {

return;

}

if (!Matrix4.equals(Matrix4.IDENTITY, this.transform)) {

this.frustum.width = Cartesian3.magnitude(this.position);

return;

}

var scene = this._scene;

var globe = scene._globe;

var rayIntersection;

var depthIntersection;

/*

// !!! This broke orhto mode zoom badly !!!

if (defined(globe)) {

var mousePosition = scratchAdjustOrtghographicFrustumMousePosition;

mousePosition.x = scene.drawingBufferWidth / 2.0;

mousePosition.y = scene.drawingBufferHeight / 2.0;

var ray = this.getPickRay(mousePosition, pickGlobeScratchRay);

rayIntersection = globe.pick(ray, scene, scratchRayIntersection);

if (scene.pickPositionSupported) {

depthIntersection = scene.pickPositionWorldCoordinates(mousePosition, scratchDepthIntersection);

}

if (defined(rayIntersection) && defined(depthIntersection)) {

var depthDistance = defined(depthIntersection) ? Cartesian3.distance(depthIntersection, this.positionWC) : Number.POSITIVE_INFINITY;

var rayDistance = defined(rayIntersection) ? Cartesian3.distance(rayIntersection, this.positionWC) : Number.POSITIVE_INFINITY;

this.frustum.width = Math.min(depthDistance, rayDistance);

} else if (defined(depthIntersection)) {

this.frustum.width = Cartesian3.distance(depthIntersection, this.positionWC);

} else if (defined(rayIntersection)) {

this.frustum.width = Cartesian3.distance(rayIntersection, this.positionWC);

}

}

if (!defined(globe) || (!defined(rayIntersection) && !defined(depthIntersection))) */

{

var distance = Math.max(this.positionCartographic.height, 0.0);

this.frustum.width = distance;

}

};

I’m still having trouble duplicating, but I believe you! We have an issue open in GitHub, #3845 - Camera.positionWC incorrect for 2D and CV, which I think is the origin of this. I’ve bumped with this report as well.