Three.js:如何将旋转矩阵应用于某些基础对象的状态? [英] Three.js: how to apply rotation matrix to some base object's state?

查看:143
本文介绍了Three.js:如何将旋转矩阵应用于某些基础对象的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题

Three.js:applyMatrix之后的混沌网格旋转

我问了一个问题.

现在,我将尝试从另一个角度看问题:描述程序的期望行为.

对于对象状态的每个时间点,我都有一个旋转矩阵数组. 每个旋转矩阵表示某个初始对象状态(零点)与所需状态之间的差.用户应该可以随时从阵列中选择任何所需的旋转矩阵.

如何对此类数据进行正确的轮换?

Three.js r.58

解决方案

Three.js希望用户设置对象的positionrotationscale,然后渲染器更新对象matrixrender()函数中.

通常不建议直接操作矩阵,除非您真的知道自己在做什么.

无论如何,这样的事情应该起作用.

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

three.js r.58

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

解决方案

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

这篇关于Three.js:如何将旋转矩阵应用于某些基础对象的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆