i tried to reuse youre code from the EntityRotator and there is something i dont understand about the function
Code: Select all
public static Vector3 GetAngularVelocity(Quaternion start, Quaternion end, float dt);
Code: Select all
var direction = Vector3.Normalize( Vector3.Backward*10 + Vector3.Left + Vector3.Down ); // backwards and slightly left down
// get Target direction as Quaternion
var left = Vector3.Cross( direction, Vector3.Up );
var up = Vector3.Cross( left, direction );
var dir = Quaternion.CreateFromRotationMatrix( Matrix.CreateWorld( Vector3.Zero, direction, up ) );
// get Faceing direction as Quaternion
left = Vector3.Cross( facingDir, Vector3.Up );
up = Vector3.Cross( left, facingDir );
var face = Quaternion.CreateFromRotationMatrix( Matrix.CreateWorld( Vector3.Zero, facingDir, up ) );
// get Velocity
var axis = BEPUphysics.Paths.PathFollowing.EntityRotator.GetAngularVelocity( face, dir, 1 );
var rot = Quaternion.CreateFromYawPitchRoll( axis.Y, axis.X, axis.Z ); // convert back to Quaternion
And even for short Distances the result may be wrong but i cant figure out why.
btw, thx for the great work so far it rocks.