Three.js: how to apply rotation matrix to some base object's state?

假如想象 提交于 2020-01-14 03:49:07

问题


In this question

Three.js: chaotic mesh rotation after applyMatrix

I asked about an issue.

Now I'll try to look at the issue from another end: to describe the desired behaviour of the program.

I have an array of rotation matrices for each time point of object's state. Each rotation matrix represents a difference between some initial object state (point zero) and the desired state. User should be able at any time select any desired rotation matrix from the array.

How to implement the correct rotation for such data?

Three.js r.58


回答1:


Three.js expects the user to set the object's position, rotation, and scale, and then the renderer updates the object matrix in the render() function.

Usually it is unadvisable to manipulate the matrix directly, unless you really know what you are doing.

In any event, something like this should work.

object.matrix.copy( matrixIntiial );
object.applyMatrix( matrixDelta );

three.js r.58



来源:https://stackoverflow.com/questions/17240008/three-js-how-to-apply-rotation-matrix-to-some-base-objects-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!