mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
performance boost for scalar
This commit is contained in:
@@ -159,8 +159,9 @@ local function RotationMatrix(X: number, Y: number, Z: number): RotationMatrix
|
||||
end
|
||||
|
||||
local function Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar
|
||||
local dX, dY = X1-X2, Y1-Y2
|
||||
return {
|
||||
Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
|
||||
Distance = math.sqrt(dX*dX+dY*dY),
|
||||
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2);
|
||||
Rotation = math.deg(math.atan2(Y1-Y2,X1-X2))
|
||||
}
|
||||
|
||||
@@ -59,9 +59,10 @@ function Math.RotationMatrix(X: number, Y: number, Z: number): RotationMatrix
|
||||
end
|
||||
|
||||
function Math.Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar
|
||||
local dX, dY = X1-X2, Y1-Y2
|
||||
return {
|
||||
Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
|
||||
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2);
|
||||
Distance = math.sqrt(dX*dX+dY*dY),
|
||||
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2),
|
||||
Rotation = math.deg(math.atan2(Y1-Y2,X1-X2))
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user