Page 1 of 1

OrientationMatrix does not update when Orientation is set?!

Posted: Sun May 22, 2011 1:30 am
by Spankenstein
If I set the 'Orientation' property of an entity then the OrientationMatrix doesn't update immediately:

Code: Select all

            entity.Orientation = Quaternion.CreateFromRotationMatrix(MathTools.RotationFrom(Vector3.UnitX));
            Console.WriteLine(entity.Orientation);
            Console.WriteLine(entity.OrientationMatrix.Forward);

            entity.Orientation = Quaternion.CreateFromRotationMatrix(MathTools.RotationFrom(Vector3.UnitY));
            Console.WriteLine(entity.Orientation);
            Console.WriteLine(entity.OrientationMatrix.Forward);
Result:

Code: Select all

{X:0 Y:0 Z:0 W:0.9999999}       // Orientation
{X:0 Y:0 Z:-1}                          // Orientation Matrix
{X:0 Y:0 Z:0.9999999 W:0}       // Orientation
{X:0 Y:0 Z:-1}                          // Orientation Matrix
This makes things like boids and AI rather difficult to implement with the current version of the physics engine :(

Re: OrientationMatrix does not update when Orientation is se

Posted: Sun May 22, 2011 1:47 am
by Norbo
Is that in v0.14.3? Those used to be buffered properties which would not write until the subsequent frame's write stage. The "Internal" prefixed properties were unbuffered.

In the current version, both the Orientation and OrientationMatrix properties directly get/set the internal values.

Re: OrientationMatrix does not update when Orientation is se

Posted: Sun May 22, 2011 10:25 am
by Spankenstein
I'm using the latest build with XNA 4.0, which is why it struck me as odd.

Re: OrientationMatrix does not update when Orientation is se

Posted: Sun May 22, 2011 8:29 pm
by Norbo
I'm using the latest build with XNA 4.0, which is why it struck me as odd.
I would recommend checking the individual values being set in detail. You can check the source for those properties- they don't do much at all. It should be fairly easy to narrow down the cause.