public static MWQuaternion ApplyPatch(this MWQuaternion _this, QuaternionPatch quaternion)
        {
            if (quaternion == null)
            {
                return(_this);
            }

            if (quaternion.W != null)
            {
                _this.W = quaternion.W.Value;
            }

            if (quaternion.X != null)
            {
                _this.X = quaternion.X.Value;
            }

            if (quaternion.Y != null)
            {
                _this.Y = quaternion.Y.Value;
            }

            if (quaternion.Z != null)
            {
                _this.Z = quaternion.Z.Value;
            }

            return(_this);
        }
        public static QuaternionPatch GeneratePatch(MWQuaternion _old, Quaternion _new)
        {
            if (_old == null && _new != null)
            {
                return(new QuaternionPatch(_new));
            }
            else if (_new == null)
            {
                return(null);
            }

            var patch = new QuaternionPatch()
            {
                X = _old.X != _new.x ? (float?)_new.x : null,
                Y = _old.Y != _new.y ? (float?)_new.y : null,
                Z = _old.Z != _new.z ? (float?)_new.z : null,
                W = _old.W != _new.w ? (float?)_new.w : null
            };

            if (patch.IsPatched())
            {
                return(patch);
            }
            else
            {
                return(null);
            }
        }
 internal QuaternionPatch(MWQuaternion quaternion)
 {
     X = quaternion.X;
     Y = quaternion.Y;
     Z = quaternion.Z;
     W = quaternion.W;
 }
Пример #4
0
 public static MWQuaternion FromGodotQuaternion(this MWQuaternion _this, Quat other)
 {
     _this.W = other.w;
     _this.X = -other.x;
     _this.Y = -other.y;
     _this.Z = other.z;
     return(_this);
 }
 public static MWQuaternion FromUnityQuaternion(this MWQuaternion _this, Quaternion other)
 {
     _this.W = other.w;
     _this.X = other.x;
     _this.Y = other.y;
     _this.Z = other.z;
     return(_this);
 }
Пример #6
0
 public static MWQuaternion SetValue(this MWQuaternion _this, Quaternion value)
 {
     _this.W = value.w;
     _this.X = value.x;
     _this.Y = value.y;
     _this.Z = value.z;
     return(_this);
 }
Пример #7
0
 /// <inheritdoc />
 public void RigidBodyMoveRotation(MWQuaternion rotation)
 {
     _updateActions.Enqueue(
         (rigidBody) =>
     {
         rigidBody.MoveRotation(_sceneRoot.rotation * rotation.ToQuaternion());
     });
 }
Пример #8
0
        public static Quaternion GetPatchApplied(this Quaternion _this, MWQuaternion quaternion)
        {
            _this.w = _this.w.GetPatchApplied(quaternion.W);
            _this.x = _this.x.GetPatchApplied(quaternion.X);
            _this.y = _this.y.GetPatchApplied(quaternion.Y);
            _this.z = _this.z.GetPatchApplied(quaternion.Z);

            return(_this);
        }
Пример #9
0
 public static Quat ToQuaternion(this MWQuaternion _this)
 {
     return(new Quat()
     {
         w = _this.W,
         x = _this.X,
         y = _this.Y,
         z = _this.Z
     });
 }
Пример #10
0
 internal TransformPatch(MWVector3 position, MWQuaternion rotation, MWVector3 scale)
 {
     this.Position = new Vector3Patch(position);
     this.Rotation = new QuaternionPatch(rotation);
     this.Scale    = new Vector3Patch(scale);
 }
 internal ScaledTransformPatch(MWVector3 position, MWQuaternion rotation, MWVector3 scale)
     : base(position, rotation)
 {
     this.Scale = new Vector3Patch(scale);
 }