YawPitchRoll`

There is no YawPitchRoll matrix in XNA.....

Why?

[61 byte] By [Xadja] at [2007-12-24]
# 1

There you go....

public static Matrix CreateYawPitchRoll(float yaw, float pitch, float roll)
{
Matrix yawMatrix = Matrix.CreateRotationZ(yaw);
Matrix pitchMatrix = Matrix.CreateRotationY(pitch);
Matrix rollMatrix = Matrix.CreateRotationX(roll);

Matrix combined = Matrix.Multiply(Matrix.Multiply(yawMatrix, pitchMatrix), rollMatrix);
return combined;
}

JimBlackler at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2

yawMatrix=Matrix.CreateRotationZ(yaw);?

or

yawMatrix =Matrix.CreateRotationY(yaw);?

Matrix combined = Matrix.Multiply(Matrix.Multiply(yawMatrix, pitchMatrix), rollMatrix);

it will be work very slow.....:(

may be i can build rotating matrix with precomputed values of sin and cos....?

Xadja at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
That won't be slow at all, at least not any slower than if we'd

included this in the framework. That's how you construct a

yaw/pitch/roll matrix, so if it was in the library, we'd just be making

three separate matrices and then multiplying them together internally!

If you are concerned about performance, this sort of code can often be

made more efficient using quaternions, which can represent any kind of

rotation using just four floats (and also don't suffer from the same

gymbal lock problems that axis rotations are prone to).

Almost certainly this code won't be your performance bottleneck, though, in which case why worry about it?

ShawnHargreaves at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 4

Come again?

How about pre-multiplying three rotation matrices on, lets say, paper, and just substitute the variables in the CreateYPR method? So if it was in the library, you most definitely would never need to create any extra matrices and multiply them, just calculate sin/cos for all angles and set 9 floats. Not to mention matrix multiplication without the ref keyword gives pretty poor performance which I believe would be nice to mention in the code above.

Now naturally this guy's YPR matrix will most probably not be a bottleneck (altho how do you know he doesn't have ten million little aircrafts simulation?), but it's a matter of principles here. I can tell you right now I expect the base classes to be top quality, your response scares me to the point where I'll be considering my own math classes which is exactly the opposite of how this should work.

Wojtek

http://www.pouet.net/groups.php?which=35
http://www.pouet.net/groups.php?which=56

WojtekPodgorski at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 5
I couldn't agree more. It seems that the main focus of XNA is the XBox and the PC as a gaming platform seems to be secondary.
SteveHoff at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 6
The focus of XNA is on multiplatform development. XBox is obviously an important part of that, but we take PC very seriously too!
ShawnHargreaves at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...