I really need HELP!!

I really can’t understand how to TILT the camera UP and DOWN.

I can tilt the camera LEFT and RIGHT with

camera.rotate(target, angle) where “target” is a Cartesian3,

but how to do for UP and DOWN?

Does rotateUp (and rotateDown) not do what you need here?

https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=Camera#rotateUp

The rotate function just takes an axis to rotate around, not a target. So you could just give it a perpendicular axis instead to rotate the other way(s).

Thank-you Omar,
from what I can read on the API documentation “camera.rotate(Cartesian3, angle)” need the Cartesian3 in wp (world position).

Maybe I can’t understand the concept of Cartesian3, but in my idea (I’ve been working on 3d for al long time) it’s a point in 3d world space (so it seem to be a target point as reference for the rotation).

It could be a vector too, if referred to Cartesian3(0,0,0), but honestly I can’t realize how it could be transformed to rotate on X (or Y) axis instead of its Z axis.

What do you mean by “axis”?

A Cartesian3 is just a vector. It may be a point, or it may be a direction, depending on how it’s being used and what the function you’re passing it to expects.

In this case, it’s a direction. It’s easiest to see by trying it out with the unit axes. Try running this code in Sandcastle to see what rotating around each of these axes means:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var camera = viewer.scene.camera;

camera.rotate(Cesium.Cartesian3.UNIT_X, 0.1);

});

camera.rotate(Cesium.Cartesian3.UNIT_Y, 0.1);

});

camera.rotate(Cesium.Cartesian3.UNIT_Z, 0.1);

});

``

Here’s a Sandcastle link with the axes visualized. Notice how when you rotate, the point that stays fixed (the center of rotation) is the center of the earth. You cannot change this by changing the argument to this function.

If your goal is to change the “target” of the rotation as you describe it, you would need to change the camera’s reference frame. See the Sandcastle example I described in this thread: https://groups.google.com/d/msg/cesium-dev/u9qZFOcFFQc/dx4OA-MSBQAJ

Really many thanks Omar, now it’s perfectly clear.
Indeed I’ve solved fixing the camera reference frame to the Cartesian3 (as a point) given by the intersection of the ray from the camera in the center of the canvas and the 3d terrain,

and next rotate the camera up-down-left-right