#Math.

1 messages · Page 1 of 1 (latest)

dull totem
#

The only thing I can think of is getting each side's position and comparing the new one, but thatd be both ugly and resource intensive

#
        local projectedPosition = Util.getProjectedMousePosition(selectedShape, arrowPart)
        local differenceLength = Vector3.new(
            projectedPosition.X - initArrowPosition.X,
            projectedPosition.Y - initArrowPosition.Y,
            projectedPosition.Z - initArrowPosition.Z)
        
        differenceLength = Vector3.new(
            math.floor(differenceLength.X / .75 + .5) * .75,
            math.floor(differenceLength.Y / .75 + .5) * .75,
            math.floor(differenceLength.Z / .75 + .5) * .75)
        
        -- Initial size + difference in arrow = new size
        local newSize = Vector3.new(
            initSize.X + identityOffset.X * differenceLength.X,
            initSize.Y + identityOffset.Y * differenceLength.Y,
            initSize.Z + identityOffset.Z * differenceLength.Z)

        local newPosition = Vector3.new(
            math.abs(identityOffset.X) * (initPosition.X + differenceLength.X / 2),
            math.abs(identityOffset.Y) * (initPosition.Y + differenceLength.Y / 2),
            math.abs(identityOffset.Z) * (initPosition.Z + differenceLength.Z / 2))
        
        newPosition = Vector3.new(
            (newIdentity.X * initPosition.X) + newPosition.X,
            (newIdentity.Y * initPosition.Y) + newPosition.Y,
            (newIdentity.Z * initPosition.Z) + newPosition.Z)

I'm currently doing the math like this snippet