Reputation: 143
I try to write an export of an 3-d plant modelling software to Three.js but got stuck with the rotations and translations of the objects.
So far I tried to use quaternions and transformation matrices but both results are not satisfying. For my tests I use a simple binary tree that originally looks like this:
the results of my export are this:
You can find the code of both export under
http://ufgb966.forst.uni-goettingen.de/three/test2Quaternion.html
http://ufgb966.forst.uni-goettingen.de/three/test2Matrix.html
It seams that my rotations are made around the wrong point. Each rotation should be done around the origin of each geometry. What would be a method to achieve the result I'm looking for?
Upvotes: 6
Views: 485
Reputation: 3001
Just in case you haven't already, you might want to take a look at this: Using Matrices & Object3Ds in THREE and this How to use matrix for transformation, it helped me out. Also note that three.js uses a right handed coordinate system which you probably know.
If you export from blender, try -Z Forward, Y up.
Upvotes: 5
Reputation: 92657
In my opinion you must change sequence of translation and rotation transformations - the problem is in transformations sequence.
Upvotes: 0