Example #1
0
        void ApplyRootImportOptions(ref AffineTransform trajectory)
        {
            trajectory = trajectory.alignHorizontally();

            AffineTransform offset = AffineTransform.identity;

            offset.t.y = heightOffset;
            offset.q   = quaternion.RotateY(math.radians(rotationOffset));

            if (lockRootPositionXZ)
            {
                trajectory.t.x = clipFirstFrameTrajectory.t.x;
                trajectory.t.z = clipFirstFrameTrajectory.t.z;
            }

            if (lockRootHeightY)
            {
                trajectory.t.y = clipFirstFrameTrajectory.t.y;
            }

            if (lockRootRotation)
            {
                trajectory.q = clipFirstFrameTrajectory.q;
            }

            if (keepOriginalPositionY)
            {
                offset.t.y -= clipFirstFrameTrajectory.t.y;
            }

            if (keepOriginalPositionXZ)
            {
                offset.t.x -= clipFirstFrameTrajectory.t.x;
                offset.t.z -= clipFirstFrameTrajectory.t.z;
            }

            if (keepOriginalOrientation)
            {
                offset.q = math.mul(offset.q, math.conjugate(clipFirstFrameTrajectory.q));
            }

            trajectory.t = offset.t + trajectory.t;
            trajectory.q = math.mul(offset.q, trajectory.q);
        }