public override void Transform(LevelObject obj, Vector3 vec, Vector3 pivot)
        {
            var mat   = obj.modelMatrix;
            var scale = Matrix4.CreateScale(vec);

            if (toolbox.transformSpace == TransformSpace.Global)
            {
                var transPivot = Matrix4.CreateTranslation(pivot);
                mat = mat * transPivot.Inverted() * scale * transPivot;
            }
            else if (toolbox.transformSpace == TransformSpace.Local)
            {
                var transPivotOffset = Matrix4.CreateTranslation(obj.position - pivot);
                var transObj         = Matrix4.CreateTranslation(obj.position);
                var rotObj           = Matrix4.CreateFromQuaternion(obj.rotation);
                mat =
                    mat *
                    // Move to origin and remove rotation
                    transObj.Inverted() * rotObj.Inverted() *
                    // Offset by the pivot, scale, and undo pivot offset
                    transPivotOffset * scale * transPivotOffset.Inverted() *
                    // Add back object rotation and position
                    rotObj * transObj;
            }

            obj.SetFromMatrix(mat);
        }
        public override void Transform(LevelObject obj, Vector3 vec, Vector3 pivot)
        {
            var mat = obj.modelMatrix;

            if (toolbox.transformSpace == TransformSpace.Global)
            {
                var trans = Matrix4.CreateTranslation(vec);
                mat = mat * trans;
            }
            else if (toolbox.transformSpace == TransformSpace.Local)
            {
                // Compensate for scale diminishing the strength of the translation
                var trans = Matrix4.CreateTranslation(vec / obj.scale.LengthFast);
                mat = trans * mat;
            }

            obj.SetFromMatrix(mat);
        }