OrientationMatrix does not update when Orientation is set?!

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Spankenstein
Posts: 249
Joined: Wed Nov 17, 2010 1:49 pm

OrientationMatrix does not update when Orientation is set?!

Post 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 :(
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: OrientationMatrix does not update when Orientation is se

Post 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.
Spankenstein
Posts: 249
Joined: Wed Nov 17, 2010 1:49 pm

Re: OrientationMatrix does not update when Orientation is se

Post by Spankenstein »

I'm using the latest build with XNA 4.0, which is why it struck me as odd.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: OrientationMatrix does not update when Orientation is se

Post 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.
Post Reply