예제 #1
0
        public static ScaledTransformPatch GenerateLocalTransformPatch(MWScaledTransform _old, Transform _new)
        {
            if (_old == null && _new != null)
            {
                return(new ScaledTransformPatch()
                {
                    Position = GeneratePatch(null, _new.localPosition),
                    Rotation = GeneratePatch(null, _new.localRotation),
                    Scale = GeneratePatch(null, _new.localScale)
                });
            }
            else if (_new == null)
            {
                return(null);
            }

            ScaledTransformPatch transform = new ScaledTransformPatch()
            {
                Position = GeneratePatch(_old.Position, _new.localPosition),
                Rotation = GeneratePatch(_old.Rotation, _new.localRotation),
                Scale    = GeneratePatch(_old.Scale, _new.localScale)
            };

            return(transform.IsPatched() ? transform : null);
        }
예제 #2
0
        public static ScaledTransformPatch GenerateLocalTransformPatch(MWScaledTransform _old, Spatial _new)
        {
            if (_old == null && _new != null)
            {
                return(new ScaledTransformPatch()
                {
                    Position = GeneratePatch(null, _new.Transform.origin),
                    Rotation = GeneratePatch(null, new Quat(_new.Transform.basis)),
                    Scale = GeneratePatch(null, _new.Scale)
                });
            }
            else if (_new == null)
            {
                return(null);
            }

            ScaledTransformPatch transform = new ScaledTransformPatch()
            {
                Position = GeneratePatch(_old.Position, _new.Transform.origin),
                Rotation = GeneratePatch(_old.Rotation, new Quat(_new.Transform.basis)),
                Scale    = GeneratePatch(_old.Scale, _new.Scale)
            };

            return(transform.IsPatched() ? transform : null);
        }