Rotating a child shape relative to its parent's orientation

Posted by user1423893 on Game Development See other posts from Game Development or by user1423893
Published on 2012-10-04T23:30:26Z Indexed on 2012/10/05 3:52 UTC
Read the original article Hit count: 283

Filed under:
|
|
|
|

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
        }
    }

© Game Development or respective owner

Related posts about 3d

Related posts about math