YawPitchRoll`
There is no YawPitchRoll matrix in XNA.....
Why?
There is no YawPitchRoll matrix in XNA.....
Why?
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;
}
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....?
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?
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