TrackedEntity vs EntityView

Hi,

I have a 3d Terrain map and a path and a 3D model in GLB all this works great if I use trackedEntity (v1.122). However the camera is locked and the user cant rotate round the model. So Instead I use the following …

        const planeEntity = viewer.entities.add({
            availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
                start: startTime,
                stop: stopTime
            })]),
            position: position,
            orientation: adjustedOrientation, // Use the adjusted orientation
            model: {
                uri: 'https://xxxxxxx/3d/Airtractor4.glb', // Plane model URI
                scale: 1.0
            },
            path: {
                resolution: 1, // Smoothness of the path
                material: new Cesium.PolylineGlowMaterialProperty({
                    glowPower: 0.1,
                    color: Cesium.Color.YELLOW
                }),
                width: 10
            }
        });

         // Remove the trackedEntity assignment
        // viewer.trackedEntity = planeEntity;

        console.log(planeEntity);

        // Set up an EntityView to follow the plane
        const entityView = new Cesium.EntityView(planeEntity, viewer.scene, viewer.scene.mapProjection.ellipsoid);

        // Update the camera to follow the plane
        viewer.scene.preRender.addEventListener(function (scene, time) {
            if (planeEntity.isAvailable(time)) {
                entityView.update(time);
            }
        });

        // Optionally, adjust the camera offset
        entityView.offset3D = new Cesium.Cartesian3(-500.0, -500.0, 300.0); 

The path loads and the timeline is running but there is NO planeEntity model visible?
The console.log seems to indicate that the planeEntity is available at the time the entityView is being created.

Any suggestions please as I’m totally stuck !

Many Thanks
Ted

Hi @tedfire ,
Thanks for your post, welcome to the Cesium community, and apologies for the delay in getting back to you.

I don’t think it is expected behavior for trackedEntity to “lock” the camera. Perhaps looking at this sandcastle example Cesium Sandcastle could be a useful demonstrates for how to use trackedEntity while still being able to maneuver the camera relative to the model as it moves along a path. The linked example uses a czml instead of a glb, but the behavior of trackedEntity is the same for both types.

Please let us know if there is behavior you are seeking to get that is not covered in the example and we would be happy to continue to help.
Thanks,
Luke

Hi Luke, thanks for coming back to me. Yes you are right ! I went through multiple iterations of code and later found that the camera was no longer locked using trackedEntity ! I must have done something daft ! trackedEntity turned out to be perfect and I can orbit around the model no problem. Thanks for the heads up !