问题
I am trying to understand the co-ordinate spaces of three.js, I understand that there is object.matrix and object.matrixWorld.
After stumbling upon this blog post Matrix Basics. How to step away from storing an orientation as ’3 angles’, I decided to try to learn how to manipulate properties of the Matrix4 manually thus avoiding using Euler rotations.
All I am trying to do is translate my cube away from the origin 0,0,0 then rotate it in world space. The result in my mind would be that the cube translates on y axis first, then the rotate would bring it in a large arc back to the plane, but what actually happens is it just goes back to the origin ignoring the translation.
I have been doing a lot of reading about vectors and matrices and I'm confident I understand the theory behind them enough now. What I don't really get is how three.js handles the matrixWorld and matrix. I've attempted both!
Here is a fiddle to demonstrate: http://jsfiddle.net/SCXNQ/151/
Just look in the render() function to see what I'm trying to do!
EDIT - [solved] UPDATED JS FIDDLE OF WORKING VERSION 14/09/12
With the help of the answer below, I thought I would post my updated fiddle demonstrating what I wanted to achieve - http://jsfiddle.net/SCXNQ/363/
回答1:
Have a look at this, which is what I think you want.
EDIT: Oops, got the Matrix order wrong (another thing that you need to have a solid grasp of) -> try this aswell.
来源:https://stackoverflow.com/questions/11118126/manually-applying-rotations-and-translations-to-matrix4-in-three-js