Limit size of 3D model entity

I would like to limit the size of the entity as you zoom.

var entity = viewer.entities.add({
name: url,
position: position,
orientation: orientation,
model: {
uri: url,
minimumPixelSize: 128,
maximumScale: 20000,
},
});

The above code is from the Sandcastle example of the 3D model. As an example what do I need to add to get the behavior I’m looking for?

That depends, I don’t think you’ve explained well enough what you’re after. How do you want to limit the size as you zoom? WHat are you trying to achieve?

Cheers,

Alex

I would like the model on the screen to stay the same size no matter how much you zoom in.

Well, it’s not exactly what Cesium was designed for, but you can trick, hack and scam the system into something like it using inflated scale and maxScale values. If you take the original Sandcastle example for Model, replace the model clause with this;

model: {
      uri: url,
      scale: 0.000001,
      minimumPixelSize: 600,
      maximumScale: 1000000,
    },

This gives you something you can start playing with. Hope that helps.

Cheers,

Alex

2 Likes

@Alexander_Johannesen, this is new to me. Thanks for a clever hack!