Start a new topic

Distance Based Scaling.

Distance Based Scaling.


Hi there.

Trying to get my head around the distance based scaling. I uderstand if I set the height to an image drawable to 1SDU this will mean it will be displayed as if it were 1m high if it is 10m away. If the three context settings are left at defualt - ie scene.minScalingDistance at 10, scene.maxScalingDistance at 20000, and scene.scalingFactor at 0.1, then does it mean this image will scale with distance as it would in real life? So if it were 100m away it would appear the size of a 1m high object 100m away? I don't think this is what is happening though.

 

Bascially I'm trying to calculate what the real world size of an image would be, based on its distance and scaling, if its set to be 2.5 meteres high at 10m. I need to know how high it is at 100m.

 

 

 

To further this, the documentation says that if you set the variables, then the icons will scale linearly, so if min is set to 10m, max is set to 100m and scaling set to 0.1; an icon at 100m should be 10% of the size of an icon at 10 meters. This looks to be true, but an icon at 20m should be about 90% of the size, but this does not appear to be the case. It looks to be closer to half the size.

What is the scaling that is happening here?

Pleae have a look at 

AR.context functions.

AR.context.scene.globalScale
AR.context.scene.maxScalingDistance
AR.context.scene.minScalingDistance

Best regards,
Andreas

 

Hi Andreas.

Those are the variables I'm setting - the doco says that they'll cause the icons to scale in a linear fashion, but as I said that doesn't look like what seems to be happening.

 

So I have:

An Icon size set to 1SDU


AR.context.scene.maxScalingDistance Set to 10m

AR.context.scene.minScalingDistance Set to 100m

AR.context.scene.scalingFactor Set to 0.1


With this, an icon at 10m is 1SDU, and an icon at 100m is 10% of the size on screen. As the docu says that the scaling is linear, an icon at 20m I would expect to be 90% of the size of the 10m icon, but it appears to be much smaller. This is what I'm trying to understand.

 

Maybe you mized up min/max.

The following values should work as expected

AR.context.scene.minScalingDistance = 10; // which is default value anyhow
AR.context.scene.maxScalingDistance = 100;
AR.context.scene.scalingFactor = 0.1; // which is default value anyhow

Best regards,
Andreas
Login or Signup to post a comment