Rotation and positioning of geometry.

I am trying to write export of 3-dimensional plant modeling software in Three.js, but am stuck in turns and object translations.

So far I have tried to use quaternions and transformation matrices, but both results do not satisfy. For my tests, I use a simple binary tree that initially looks like this:

enter image description here

my export results:

enter image description here

The export code can be found in the section

http://ufgb966.forst.uni-goettingen.de/three/test2Quaternion.html

http://ufgb966.forst.uni-goettingen.de/three/test2Matrix.html

This suggests that my rotations are made around the wrong point. Each rotation should be performed around the beginning of each geometry. What will be the method to achieve the result I'm looking for?

+6
source share
2 answers

Just in case, if you have not already done so, you can take a look at this: Using Matrices and Object3D in THREE and How to use the matrix for transformation , it helped me. Also note that three.js uses the right coordinate system, which you probably know.

If you are exporting from a blender, try -Z Forward, Y up.

+5
source

In my opinion, you should change the sequence of transformations of translation and rotation - the problem is in the sequence of transformations.

0
source

All Articles