问题描述
所以我有一个对象,它正在旋转,然后再次平移和旋转.我将这些翻译的矩阵存储为对象成员.现在当我开始选择对象时,我需要知道这个对象的 3D 世界坐标.
So i have an object which is getting rotated then translated and rotated again. I am storing a matrix of these translations as an object member. Now when i come to object picking i need to know the 3D world coords of this object.
目前我已经能够像这样获得物体的位置
Currently i have been able to get the position of the object like so
坐标[0] = finalMatrix[12];
坐标[1] = finalMatrix[13];
坐标[2] = finalMatrix[14];
这给了我对象的正确位置,但我也想考虑旋转.
This is giving me the correct positions of the objects but i want to take the rotations into account as well.
任何帮助都会很棒...
Any help would be great...
推荐答案
所以我是个白痴……我一开始就说对了.我所需要的只是 [12][13][14] 中的位置数据.我的代码中有几个愚蠢的错误,其中一个错误是在我的光线交叉点上没有足够的迭代......现在所有的排序都被整理好了,哈哈,我在踢自己..哈哈,无论如何,谢谢你们!!
So I am an idiot... i had it correct in the first place. All i needed was the position data in [12][13][14]. I had a couple stupid bugs in my code, one of which was not having enough iterations on my ray intersection...All sorted now lol im kicking myself..haha thanks anyway guys!!
这篇关于给定一个 4x4 齐次矩阵,我如何获得 3D 世界坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!