从 matrix4() 获取翻译 [英] Get translation from matrix4()
本文介绍了从 matrix4() 获取翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于大多数three.js开发人员来说,这似乎是一个愚蠢的问题,但是,如何从转换矩阵中提取翻译?
It may look like a dummy question for most of the three.js developers but, how can a translation be extracted from the transformation matrix?
实际上我是手动提取它指向矩阵数组位置(12、13、14).
Actually I am extracting it manually pointing to the matrix array positions (12, 13, 14).
提前致谢.
推荐答案
如果你想从矩阵中提取平移分量,那么使用这个模式:
If you want to extract the translation component from the matrix, then use this pattern:
var vec = new THREE.Vector3();
vec.setFromMatrixPosition( matrix4 );
仅在需要平移、四元数和缩放组件时才使用 Matrix4.decompose()
.
Use Matrix4.decompose()
only if you need the translation, quaternion and scale components.
three.js r.73
three.js r.73
这篇关于从 matrix4() 获取翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文