xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Default unit of transforms #122

Closed jhagege closed 9 years ago

jhagege commented 9 years ago

Hi, Great job with this library!

I can see that the default unit of transforms is 'px'. Is it possible to transform (translateX, translateY, translateZ) in the unit of the XML mesh?

Thanks a lot.

csvurt commented 9 years ago

Thanks!

We only use 'px' because that's the required CSS syntax for translate3d and units like 'em' would make even less sense in a 3D context. In reality the translation is done in world space units, so if all your meshes are modeled in meters and you move one with translate3d(10px, 0, 0) it will be moved 10 meters to the right.

Once custom CSS properties are fully supported in the major browsers we can change our CSS transforms to use a unit other than 'px' but until then we're stuck with it.

We also have an xml3d tag on Stackoverflow, that would be a better place for questions because it might also help other people too. If you find any bugs or problems with the library then this issue tracker is of course the right place for those ;)