Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/254506570619179008
added 4 characters in body
Source Link
user1423893
  • 674
  • 3
  • 13
  • 32

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; //Quaternion newOrienationchildOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } 

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; Quaternion newOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } 

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; //Quaternion childOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } 

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

added 777 characters in body
Source Link
user1423893
  • 674
  • 3
  • 13
  • 32

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; Quaternion newOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } 

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } } 

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc // // Where: // Qp = Parent orientation last frame // Qp' = Parent orientation this frame // Qc = Child orientation last frame // Qc' = Child orientation this frame set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev; Quaternion newOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value; } 

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

Source Link
user1423893
  • 674
  • 3
  • 13
  • 32

Rotating a child shape relative to its parent's orientation

When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

 public Quaternion Orientation { get { return entity.Orientation; } set { Quaternion previousValue = entity.Orientation; entity.Orientation = value; // Use the difference between the quaternion values to update child orientation } }