Log in or register to post comments

How to interpret scene units

February 18, 2011 - 9:54am #1

In the Dev guide, it's mentioned that


size be defined in scene units that are related to the actual size. For example 1 scene unit is 1" (or 1cm) in the real world

So for example, if my image target is 30cm x 25cm, what does this mean in the code ? In other words, if I take the origin (0,0,0) as at the center of the image target, what is the coordinate of the other side ?
E.g, take some image targets such as "stones", "chips"....
| |
| |
I need this to "span" a 3D model over the target. Currently, I have a working code to load 3D model, but it only lies somewhere in the middle. So I figure that a glscale.. call might help; therefore size of the target is needed.

Re: How to interpret scene units

February 18, 2011 - 10:48am #2

The trick to this is in the config.xml file. When you download your tracking data from the online system, it assigns a default size to the target. Open up config.xml (located in the assets folder) and look at the size parameter for your target. The values there are (width height) and will be the units that OpenGL uses when placing content. You can change these values by hand, as long as you do not change the aspect ratio.

You can query the size of the target at runtime using the ImageTarget::getSize() method.

Finally, remember that positive X is to the right of the origin (center of the target), and positive Y points towards the top of the target. Positive Z comes up out of the target, perpendicular to it. So your ? in the diagram above would be (myImageTarget.getSize().data[0] / 2.0f, 0.0f, 0.0f).

- Kim

Log in or register to post comments