collada Unit

<unit name=“centimeters” meter=“0.01”/>

From the above line that i extracted from the collada file.I just like to know what actually collada does with centimeters or meter or feet.I found that this is used for scaling purpose.if so then what could make differences from centimeters,meter,foot etc.What collada do with centimeters…

Thanks

COLLADA stores the unit of distance measure of the real world values in the document or asset.

It means that all the real world values of distance and position in the asset (document in this case) are in centimeters. For example, a vertex position of (1,2,3) means (1cm,2cm,3cm).

If your application works in centimeters (like Maya) then you’re fine.

Otherwise you may have to apply the appropriate scale to bring the values into proportion with other objects that are modeled with a different measure of distance. For example, if your viewer is using meters (and you care, i.e. some tools are unit-less) then you would scale that vertex position to (.01m,.02m,0.3m) with the <unit> information.

Examples of real world values affects by the unit of distance include:
[ul]
[li] position[/:m:2rtx1zhu][/li][li] translate[/:m:2rtx1zhu][/li][li] scale[/:m:2rtx1zhu][/li][li] matrix[/:m:2rtx1zhu][/li][li] lookat[/:m:2rtx1zhu][/li][li] znear and zfar (of cameras)[/:m:2rtx1zhu][/li][li] gravity[/:m:2rtx1zhu][/li][] animation data of any of the above[/*:m:2rtx1zhu][/ul]

Another question about the Unit.

I would like to specify a unit in meters, instead of centimeters (as seen in most samples):


daeElement* unit = asset->add("unit");
result = unit->setAttribute("meter", "1.0");
assert(result);
result = unit->setAttribute("name", "meter");
assert(result);

I don’t get any assert, so I first guessed it was fine, but in the .dae my unit section is empty :

<unit/>

Any ideas about how setting a unit in meter ?

Thanks

You’re probably okay. The default unit is meters in COLLADA, so probably the COLLADA DOM is not writing it out explicitly to save space.

Btw: Maya default unit is centimeters and is probably the exporter of your documents.

You are right.

After importing a model into GoogleEarth, my models are in meters.

Thanks!