Controls to rotate a point cloud?

First, a short aside about that message

Error, first part of bucket-requirejs.html must match first part of bucket.html exactly.

I have seen this error occasionally, but I think that this only happened during local development. If you see this with the actual online version at Cesium Sandcastle , then that’s unusual. A related thread contains different suggestions for how to solve this, like clearing cache and cookies. If this thread does not help, this may have to be investigated further.


About the controls:

The “default controls” may appear to be “unintuitive” when there is no geolocation involved. The standard interactions in CesiumJS are pretty much tailored for an intuitive navigation on the globe (which is unbelievably challenging). Beyond that, there are always many degrees of freedom for user interactions.

(Anecdotal: When dragging the mouse to rotate, then there may be two expectations: CAD people expect the model to rotate. People who are more into computer games or VR expect the camera to rotate…)

However, when the goal is to examine a model that is centered in the view, without any geo-context, then you’re most likely looking for the functionality of setting the reference frame of the camera. This can be done with Camera#lookAtTransform.

The following is a Sandcaste … (and hopefully this bucket.html issue can be resolved) … is extracted from yours, and that loads an existing point cloud tileset. And it uses the following snippet to center the view at the loaded tileset:

    const transform = Cesium.Matrix4.fromTranslation(
      tileset.boundingSphere.center, new Cesium.Matrix4());
    viewer.camera.lookAtTransform(
      transform,
      new Cesium.Cartesian3(50.0, 50.0, 50.0),
    );
    viewer.camera.constrainedAxis = Cesium.Cartesian3.UNIT_Z;

This snippet uses the tileset.boundingSphere.center of the tileset as the reference frame center point. You can also manually set that point - for example, when you want to center the camera at the origin, then this could just be new Cesium.Cartesian3(0,0,0).

(Note: In the sandcastle, the model seems to be oddly rotated. This is because it already does have a geolocation. But the functionality of setting the reference frame should work for the model even when it is at the origin)