Skip to main content

OrientedShape3D - how does scaling work?

2 replies [Last post]
Joined: 2005-08-05

Hi all,

I'm running into a weird problem with OrientedShape3D. If I create one, and setConstantScaleEnable(true), and setScale(1.0), I get a shape that appears onscreen at a fixed size (no matter where I position the viewer) - just as I expect. However, a) I don't know what units the "1.0" actually corresponds to and more importantly b) this changes non-linearly as I resize the window. So, if I in my view, an OS3D looks about the same size as one of my scene objects, and I then drag the window corner to enlarge the window by a factor of about 2, my scene objects will be about twice as big (i.e., on screen, in pixel units), but the OS3D will grow by about 4.

In the process of messing around with this, I'm also finding that they sometimes disappear - I'm using an OrbitBehavior to rotate the view, and if I rotate to "underneath" the terrain and back, they're gone and don't come back into view. I haven't investigated this enough yet to isolate the cause, but none of my other scene objects do this - anyone seen this sort of thing?



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-08-15


I'm experiencing the same problem with the OrientedShape3D and window resizing as you. I just looked up the source code of this class and found a line of code in OrientedShape3DRetained, which could be the cause of this:

scale *= scaleFactor*canvas.getPhysicalWidth()/2;

Unfortunately I don't know much about the calculations, which are done in there, but someone else might find a workaround for this. By the way: This is a bug, isn't it?


Joined: 2003-06-12

Hi Bill,
I found the same problems on OS3D as you got.

About the disappearing of OS3D there is already a filed issue in the tracker: see
Vote for this item, so hopefully the developers will fix it soon.

About the constantScaleEnable=true and scale=1.0 I have the same questions:
a) I don't know what units the "1.0" actually corresponds to
b) this changes non-linearly as I resize the window

I do not want to use a behavior to maintain constant the size of an object, because it is really slow.
I use OrientedShape3D with Text3D geometries, so I want to specify the size of the font in a clear way (e.g. pixels or in some way proportional to the width of the Canvas3D)....

Does any developer have an answer?