开发者

Sending a matrix's orientation... Converting to degrees? Radians? Something without a decimal?

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?


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜