Enabling First-Person Perspective Inside of sampledTimePosition based Entity

"I have added a glb file with an interior as an entity.model and placed the spacecraft in space. I would like to enable the ability to look around from inside the spacecraft. The spacecraft is orbiting and receiving its position every 3 seconds using a SampledPositionProperty. I have successfully set the camera position to the center of the entity using a postrender event listener. However, when I drag the mouse over the surface of the globe, the camera translation doesn’t seem to work properly. I’m looking for an alternative approach.

If the viewer.current.trackedEntity = entity is set, how can I enable the ability to look around from a first-person perspective within the interior of the entity?"

const now = Cesium.JulianDate.now();
viewer.current.clock.startTime = Cesium.JulianDate.addSeconds(
now,
-3,
new Cesium.JulianDate()
);
viewer.current.clock.currentTime = Cesium.JulianDate.addSeconds(
now,
-3,
new Cesium.JulianDate()
);
viewer.current.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
viewer.current.clock.multiplier = 1.0;

axios
  .get("https://api.wheretheiss.at/v1/satellites/25544")
  .then(({ data }) => {
    const { longitude, latitude, altitude } = data;

    positionProperty.current.addSample(
      Cesium.JulianDate.now(),
      Cesium.Cartesian3.fromDegrees(longitude, latitude, altitude * 1000)
    );

      viewer.current.entities.add({
        id: "cupola",
        model: {
          uri: Cupola,
          minimumPixelSize: 128,
          maximumScale: 20000,
        },
        position: positionProperty.current,
        // show:false
      });

      const entity = viewer.current?.entities.getById("cupola");
      viewer.current.trackedEntity = entity;

const interval = setInterval(() => {
axios
.get(“https://api.wheretheiss.at/v1/satellites/25544”)
.then(({ data }) => {
const { longitude, latitude, altitude } = data;

      positionProperty.current.addSample(
        Cesium.JulianDate.addSeconds(
          Cesium.JulianDate.now(),
          3,
          new Cesium.JulianDate()
        ),
        Cesium.Cartesian3.fromDegrees(longitude, latitude, altitude * 1000)
      );
    });
}, 3000);

Hi @jobkaeHenry, welcome to the community!

If I understand you correctly, you don’t want mouse motions to change the position of the Camera, because the camera is fixed to a point within the spacecraft. You want mouse motions to change the orientation of the camera.

By default, mouse drags are converted to camera position changes, via what we call “rotate events”. To change the orientation, on a desktop/laptop you can do a SHIFT + left-click and drag. We call this a “look event”, because it changes the direction the camera is ‘looking’.

SHIFT + left-click may be a problem on mobile devices or other touch screens. However, you can change which user inputs will map to “look events” as follows:

const cameraController = viewer.scene.screenSpaceCameraController;
cameraController.rotateEventTypes = {
    eventType: Cesium.CameraEventType.LEFT_DRAG,
    modifier: Cesium.KeyboardEventModifier.SHIFT,
};
cameraController.lookEventTypes = Cesium.CameraEventType.LEFT_DRAG;

With the above code, mouse drags will now change the orientation of the camera instead of its position. (Position changes are now mapped to SHIFT + drag events). Here is a Sandcastle example demonstrating how the above code will work.

Will this solve your problem? Let me know if I misunderstood what you were trying to do.

By the way, I really like the idea of what you are building. If you’re able to share it here when it’s done, I would love to try it out!