void CheckRestrictions (BoneEntity boneEntity) { // FIRST STEP IS TO CONVERT LINK QUATERNION BACK TO EULER ANGLES Vector3 euler = boneEntity.bone.rotation.eulerAngles; // CHECK THE DOF SETTINGS if (euler.x > boneEntity.restrictionRange.xMax) euler.x = boneEntity.restrictionRange.xMax; if (euler.x < boneEntity.restrictionRange.xMin) euler.x = boneEntity.restrictionRange.xMin; if (euler.y > boneEntity.restrictionRange.yMax) euler.y = boneEntity.restrictionRange.yMax; if (euler.y < boneEntity.restrictionRange.yMin) euler.y = boneEntity.restrictionRange.yMin; if (euler.z > boneEntity.restrictionRange.zMax) euler.z = boneEntity.restrictionRange.zMax; if (euler.z < boneEntity.restrictionRange.zMin) euler.z = boneEntity.restrictionRange.zMin; // BACK TO QUATERNION boneEntity.bone.localRotation = Quaternion.Euler (euler); }