preview what i have done so far the problem only in rotation
2021-04-25 02-33-47.mkv (2.5 MB)
the piece of code
function ShiftScaling() {
let NormalMouseDistance = MouseDis();
let RotatedMouseDistance = RotateVec(NormalMouseDistance);
RotatedMouseDistance.x *= Direction[0]; // just direction when press the dots (left top / right top / bottom left / bottom right)
let YDirection = Direction[0] / Direction[1]; // just direction when press the dots (left top / right top / bottom left / bottom right)
//#region if you hold shift it should scale all sides
NewScaleX = PrevouisScale.x + RotatedMouseDistance.x / BoxSize.x; // add scale unite to Prevouis Scale
NewScaleY = PrevouisScale.y * (NewScaleX / PrevouisScale.x); // get height start from amount added to width (ratio)
NewSize =
((BoxSize.x * NewScaleX) / (BoxSize.y * NewScaleY)) * YDirection; // get new ration to get right Y pos
// Repose
ObjectMesh.position.set(
PrevouisPos.x + NormalMouseDistance.x / 2,
PrevouisPos.y + NormalMouseDistance.x / (2 * NewSize),
0
);
// Scale
ObjectMesh.scale.set(NewScaleX, NewScaleY, AnimatorObject.scale.z);
//#endregion
}