Does fromGLTFasync support callback properties for model positions?

I’m trying to load a model that has a dynamic position but I’m getting the invalid array length error when I use a call back for the models position. Is this just my lack of understand of async? How can I achieve this?

        const headingPositionRoll = new Cesium.HeadingPitchRoll(0,0,0);
    try {
        const model = await Cesium.Model.fromGltfAsync({
          url: "./models/777-200.glb",
          modelMatrix: Cesium.Transforms.headingPitchRollToFixedFrame(
            new Cesium.CallbackProperty(this.move, false),
          minimumPixelSize: 128,
       } catch (error) {
        console.log(`Failed to load model. ${error}`);

It does probably not answer your question in all depth, but maybe it’s a helpful hint, at least:

The function headingPitchRollToFixedFrame function expects several parameters. And the first parameter, origin, must be a Cartesian3. And in your case, it is not a Cartesian3, but a CallbackProperty. (One that returns a Cartesian3, probably, but it is not a Cartesian3).

If the goal is to update the matrix of the model, then the solution might contain something like

viewer.scene.preUpdate.addEventListener(function () {
    model.modelMatrix = theNewOne

But in order to give more specific hints (and in order to receive a helpful response in the first place), it is really useful when you provide a Sandcastle with the current state and a clear description of the goal.

Sorry for the late reply. I was able to get this to work thanks to your help. I’m having issues getting the viewer camera to fly to the loaded model. I’ve provided a sandcastle here but I tried using one of the demo urls for models and it doesn’t work unfortunately. All you can see is the code which kind of defeats the purpose of the sandcastle but hopefully you can see the issue.

In such cases, it might make more sense to open a new thread.

However, I assume that what you want to achieve can be accomplished by

  • waiting for the model to be loaded
  • using camera.flyToBoundingSphere to fly to the model
  model.readyEvent.addEventListener(() => {;

As a sandcastle: