in which file you entered this code?
> So you want a different tilt range? I modified the code so you can enter in degrees and it will convert to radians. Here's 10 to 60 degrees tilt range, which you can easily modify:
>
>
> if(defined(constrainedAxis))
> {
> var minTilt=10/180*Math.PI;var maxTilt=60/180*Math.PI;
> var tilt = Cartesian3.dot(camera.direction,constrainedAxis);
> tilt = Math.PI-Math.acos(tilt);
> tilt += deltaTheta;
> if(tilt<minTilt){deltaTheta += minTilt - tilt;}
> if(tilt>maxTilt){deltaTheta -= tilt - maxTilt;}
> }in which file you entered this code? ScreenSpaceController.js (rotate3D) ?
perfect man! Thanks, so very much!
You’re welcome. constrainedAxis always seems to be Cartesian3.UNIT_Z in the local frame. It and it’s negation are used as stoppers and for determining rotation axis, however if it’s anything but Cartesian3.UNIT_Z you get strange rotations. It would be nice if function rotate3D had min and max tilt as optional parameters.