发送矩阵的方向...转换为度数?弧度?没有小数点的东西?
我希望能够告诉服务器我的模型的方向,以便服务器可以将其发送回所有其他玩家。但是,通过共享内存获取值(最坏情况下采用字节值,最好情况下采用整数)。
有没有一种数学方法可以检查模型的旋转,将其转换为默认的角度值,然后将该 1-360 度值发送到服务器,而不是尝试发送整个矩阵结构的 16 个浮点值?
发送 16 个花车让我与所有参与的玩家共享了多达 120 个额外的共享内存文件。并不是真正的最佳实践。有什么见解吗?
I want to be able to tell the server my model's orientation so it can in turn send it back to all other players. However getting values through shared memory(which at worst take byte values, at best integer).
Is there a mathematical way I can check my model's rotation, convert it to a degree value off of a default and then send that 1-360 degree value to the server rather than trying to send 16 float values of the entire matrix structure?
Sending the 16 floats racks me up to 120 somethin' extra shared memory files with all players involved. Not really the best practice. Any insight?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将旋转矩阵转换为四元数是否可行?
这将减少发送整个矩阵到发送单个向量和围绕该向量的旋转。
XNA 具有四元数结构 ( http://msdn.microsoft .com/en-us/library/microsoft.xna.framework.quaternion.aspx )其中包含方法:Quaternion.CreateFromRotationMatrix,它采用旋转矩阵。
这将生成 ijk 四元数,其中 W 分量作为绕该轴的旋转 theta。
Would it be feasible convert the rotation matrix to a quaternion?
This would cut down from sending the whole matrix to sending a single vector and rotation around that vector.
XNA has a quaternion structure ( http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.quaternion.aspx ) which contains the method: Quaternion.CreateFromRotationMatrix which takes a rotational matrix.
This will generate the ijk quaternion with the W component as the rotation theta around this axis.
3×3旋转部分可以表示为3个欧拉角。但随后您必须执行大量三角操作才能来回转换。也许你的问题更容易,因为你暗示你只有 1 个自由度。
无论如何,为什么不送16个花车呢?
The 3 by 3 rotation part could be represented as 3 Euler angles. But then you've got to do quite a bit of trig to convert back and forth. Maybe your problem is easier since you hint that you only have 1 degree of freedom.
In any case why not send the 16 floats?