diff --git a/.gitignore b/.gitignore index 3e8040bfe05..3d3334e946a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ !ModuleList.txt -Exported.rbxm \ No newline at end of file +Exported.rbxm +node_modules +.env +roblox.toml \ No newline at end of file diff --git a/Modules/Client/Backings/PillBackingBuilder.lua b/Modules/Client/Backings/PillBackingBuilder.lua index 87fd227cf71..c8668e24d40 100644 --- a/Modules/Client/Backings/PillBackingBuilder.lua +++ b/Modules/Client/Backings/PillBackingBuilder.lua @@ -68,7 +68,7 @@ function PillBackingBuilder:Create(gui, options) -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) - sizeConstraint.MinSize = Vector2.new(0, 0) + sizeConstraint.MinSize = Vector2.zero sizeConstraint.Parent = pillBacking local left = self:_createLeft(options) @@ -100,7 +100,7 @@ function PillBackingBuilder:CreateVertical(gui, options) -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) - sizeConstraint.MinSize = Vector2.new(0, 0) + sizeConstraint.MinSize = Vector2.zero sizeConstraint.Parent = pillBacking local top = self:_createTop(options) @@ -163,7 +163,7 @@ function PillBackingBuilder:CreateShadow(gui, options) -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) - sizeConstraint.MinSize = Vector2.new(0, 0) + sizeConstraint.MinSize = Vector2.zero sizeConstraint.Parent = shadow local left = self:_createLeftShadow(options) diff --git a/Modules/Client/Camera/Controls/CameraControls.lua b/Modules/Client/Camera/Controls/CameraControls.lua index 46cd4de7fac..d932757e38a 100644 --- a/Modules/Client/Camera/Controls/CameraControls.lua +++ b/Modules/Client/Camera/Controls/CameraControls.lua @@ -157,7 +157,7 @@ function CameraControls:BeginDrag(beginInputObject) end)) if self._rotatedCamera.ClassName == "SmoothRotatedCamera" then - self._rotVelocityTracker = self:_getVelocityTracker(0.05, Vector2.new()) + self._rotVelocityTracker = self:_getVelocityTracker(0.05, Vector2.zero) end self._maid._dragMaid = maid @@ -308,7 +308,7 @@ function CameraControls:_handleGamepadRotateStart() local maid = Maid.new() if self._rotatedCamera.ClassName == "SmoothRotatedCamera" then - self._rotVelocityTracker = self:_getVelocityTracker(0.05, Vector2.new()) + self._rotVelocityTracker = self:_getVelocityTracker(0.05, Vector2.zero) end maid:GiveTask(RunService.Stepped:Connect(function() diff --git a/Modules/Client/Camera/Controls/GamepadRotateModel.lua b/Modules/Client/Camera/Controls/GamepadRotateModel.lua index 4e3d70a3297..2ecdb7af7e6 100644 --- a/Modules/Client/Camera/Controls/GamepadRotateModel.lua +++ b/Modules/Client/Camera/Controls/GamepadRotateModel.lua @@ -26,7 +26,7 @@ end function GamepadRotateModel:GetThumbstickDeltaAngle() if not self._lastInputObject then - return Vector2.new() + return Vector2.zero end return Vector2.new(self._rampVelocityX.p, self._rampVelocityY.p) diff --git a/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera.lua b/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera.lua index db93bd02eca..f30fb081ba1 100644 --- a/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera.lua +++ b/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera.lua @@ -100,7 +100,7 @@ function FadeBetweenCamera:__index(index) if animating then return self._spring.Velocity else - return Vector3.new(0, 0, 0) + return Vector3.zero end elseif index == "HasReachedTarget" then local animating = SpringUtils.animating(self._spring) diff --git a/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera3.lua b/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera3.lua index 85e7b0d63a4..326ce8ec7b1 100644 --- a/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera3.lua +++ b/Modules/Client/Camera/Effects/FadeBetween/FadeBetweenCamera3.lua @@ -108,7 +108,7 @@ function FadeBetweenCamera3:__index(index) if animating then return self._spring.Velocity else - return Vector3.new(0, 0, 0) + return Vector3.zero end elseif index == "HasReachedTarget" then local animating = SpringUtils.animating(self._spring) diff --git a/Modules/Client/Camera/Effects/ImpulseCamera.lua b/Modules/Client/Camera/Effects/ImpulseCamera.lua index c0eb6c99d72..5985d71bd35 100644 --- a/Modules/Client/Camera/Effects/ImpulseCamera.lua +++ b/Modules/Client/Camera/Effects/ImpulseCamera.lua @@ -13,7 +13,7 @@ ImpulseCamera.ClassName = "ImpulseCamera" function ImpulseCamera.new() local self = setmetatable({ - _spring = Spring.new(Vector3.new(0, 0, 0)) + _spring = Spring.new(Vector3.zero) }, ImpulseCamera) self._spring.Damper = 0.5 diff --git a/Modules/Client/Camera/Effects/LagPointCamera.lua b/Modules/Client/Camera/Effects/LagPointCamera.lua index 0c107238419..8541a39f682 100644 --- a/Modules/Client/Camera/Effects/LagPointCamera.lua +++ b/Modules/Client/Camera/Effects/LagPointCamera.lua @@ -19,7 +19,7 @@ LagPointCamera._OriginCamera = nil function LagPointCamera.new(originCamera, focusCamera) local self = setmetatable({}, LagPointCamera) - self.FocusSpring = Spring.new(Vector3.new()) + self.FocusSpring = Spring.new(Vector3.zero) self.OriginCamera = originCamera or error("Must have originCamera") self.FocusCamera = focusCamera or error("Must have focusCamera") self.Speed = 10 @@ -36,7 +36,7 @@ function LagPointCamera:__newindex(index, value) rawset(self, "_" .. index, value) self.FocusSpring.Target = self.FocusCamera.CameraState.Position self.FocusSpring.Position = self.FocusSpring.Target - self.FocusSpring.Velocity = Vector3.new(0, 0, 0) + self.FocusSpring.Velocity = Vector3.zero elseif index == "OriginCamera" then rawset(self, "_" .. index, value) elseif index == "LastFocusUpdate" or index == "FocusSpring" then diff --git a/Modules/Client/Camera/Effects/SmoothPositionCamera.lua b/Modules/Client/Camera/Effects/SmoothPositionCamera.lua index 91aea1b4f86..f3405209865 100644 --- a/Modules/Client/Camera/Effects/SmoothPositionCamera.lua +++ b/Modules/Client/Camera/Effects/SmoothPositionCamera.lua @@ -15,7 +15,7 @@ SmoothPositionCamera.ClassName = "SmoothPositionCamera" function SmoothPositionCamera.new(baseCamera) local self = setmetatable({}, SmoothPositionCamera) - self.Spring = Spring.new(Vector3.new()) + self.Spring = Spring.new(Vector3.zero) self.BaseCamera = baseCamera or error("Must have BaseCamera") self.Speed = 10 @@ -31,7 +31,7 @@ function SmoothPositionCamera:__newindex(index, value) rawset(self, "_" .. index, value) self.Spring.Target = self.BaseCamera.CameraState.Position self.Spring.Position = self.Spring.Target - self.Spring.Velocity = Vector3.new(0, 0, 0) + self.Spring.Velocity = Vector3.zero elseif index == "_lastUpdateTime" or index == "Spring" then rawset(self, index, value) elseif index == "Speed" or index == "Damper" or index == "Velocity" or index == "Position" then diff --git a/Modules/Client/Character/HumanoidMoveDirectionUtils.lua b/Modules/Client/Character/HumanoidMoveDirectionUtils.lua index 0b50e3b7d9c..ed39d21357b 100644 --- a/Modules/Client/Character/HumanoidMoveDirectionUtils.lua +++ b/Modules/Client/Character/HumanoidMoveDirectionUtils.lua @@ -8,8 +8,8 @@ local UserInputService = game:GetService("UserInputService") local getRotationInXZPlane = require("getRotationInXZPlane") -local ZERO_VECTOR = Vector3.new(0, 0, 0) -local RIGHT = Vector3.new(1, 0, 0) +local ZERO_VECTOR = Vector3.zero +local RIGHT = Vector3.xAxis local DIRECTION_INPUT_MAPS = { [Enum.KeyCode.Left] = -RIGHT; [Enum.KeyCode.Right] = RIGHT; diff --git a/Modules/Client/Gui/UltrawideContainerUtils.lua b/Modules/Client/Gui/UltrawideContainerUtils.lua index 4ef2662a467..3679643763f 100644 --- a/Modules/Client/Gui/UltrawideContainerUtils.lua +++ b/Modules/Client/Gui/UltrawideContainerUtils.lua @@ -15,7 +15,7 @@ function UltrawideContainerUtils.createContainer(parent) local uiSizeConstraint = Instance.new("UISizeConstraint") uiSizeConstraint.MaxSize = Vector2.new(1920, 1080) - uiSizeConstraint.MinSize = Vector2.new(0, 0) + uiSizeConstraint.MinSize = Vector2.zero uiSizeConstraint.Parent = frame frame.Parent = parent diff --git a/Modules/Client/IK/IKServiceClient.lua b/Modules/Client/IK/IKServiceClient.lua index d6d830bbda7..fc19885c9bf 100644 --- a/Modules/Client/IK/IKServiceClient.lua +++ b/Modules/Client/IK/IKServiceClient.lua @@ -52,6 +52,10 @@ end --- which will override for a limited time. -- @param position May be nil to set no position function IKServiceClient:SetAimPosition(position, optionalPriority) + if position ~= position then + return + end + local aimer = self:GetLocalAimer() if not aimer then return diff --git a/Modules/Client/Particles/ParticleEngineClient.lua b/Modules/Client/Particles/ParticleEngineClient.lua index 309865d3c6b..ff3d29dbeb7 100644 --- a/Modules/Client/Particles/ParticleEngineClient.lua +++ b/Modules/Client/Particles/ParticleEngineClient.lua @@ -90,11 +90,11 @@ function ParticleEngineClient:Add(p) return end - p.Position = p.Position or Vector3.new() - p.Velocity = p.Velocity or Vector3.new() + p.Position = p.Position or Vector3.zero + p.Velocity = p.Velocity or Vector3.zero p.Size = p.Size or Vector2.new(0.2,0.2) - p.Bloom = p.Bloom or Vector2.new() - p.Gravity = p.Gravity or Vector3.new() + p.Bloom = p.Bloom or Vector2.zero + p.Gravity = p.Gravity or Vector3.zero p.Color = p.Color or Color3.new(1,1,1) p.Transparency = p.Transparency or 0.5 @@ -145,7 +145,7 @@ function ParticleEngineClient:_updatePosVel(p, dt, t) if p.WindResistance then wind = (particleWind(t, p.Position)*self._windSpeed - p.Velocity)*p.WindResistance else - wind = Vector3.new() + wind = Vector3.zero end p.Velocity = p.Velocity + (p.Gravity + wind)*dt diff --git a/Modules/Client/Skybox/FakeSkyboxSide.lua b/Modules/Client/Skybox/FakeSkyboxSide.lua index 6bfc1bc64dc..45c84136814 100644 --- a/Modules/Client/Skybox/FakeSkyboxSide.lua +++ b/Modules/Client/Skybox/FakeSkyboxSide.lua @@ -57,7 +57,7 @@ function FakeSkyboxSide:UpdateSizing() local Offset = Direction * self.PartWidth/2 self.Relative = CFrame.new(Direction*(self.PartSize/2) + Offset) - * CFrame.new(Vector3.new(0, 0, 0), -Direction) + * CFrame.new(Vector3.zero, -Direction) if self.Normal == Enum.NormalId.Bottom then -- Hack diff --git a/Modules/Server/IK/IKService.lua b/Modules/Server/IK/IKService.lua index c8d2beebd50..cd17efac91b 100644 --- a/Modules/Server/IK/IKService.lua +++ b/Modules/Server/IK/IKService.lua @@ -6,7 +6,6 @@ local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Never local Players = game:GetService("Players") local RunService = game:GetService("RunService") -local CharacterUtils = require("CharacterUtils") local IKConstants = require("IKConstants") local Binder = require("Binder") local Maid = require("Maid") @@ -78,15 +77,6 @@ function IKService:UpdateServerRigTarget(humanoid, target) serverRig:SetRigTarget(target) end -function IKService:_onServerEvent(player, target) - assert(typeof(target) == "Vector3") - - local humanoid = CharacterUtils.getAlivePlayerHumanoid(player) - if not humanoid then - return - end -end - function IKService:_handlePlayerRemoving(player) self._maid[player] = nil end diff --git a/Modules/Server/IK/Rig/IKRig.lua b/Modules/Server/IK/Rig/IKRig.lua index 67cc4e43004..79e3d65e727 100644 --- a/Modules/Server/IK/Rig/IKRig.lua +++ b/Modules/Server/IK/Rig/IKRig.lua @@ -52,6 +52,11 @@ function IKRig:_onServerEvent(player, target) assert(player == CharacterUtils.getPlayerFromCharacter(self._obj)) assert(typeof(target) == "Vector3" or target == nil) + -- Guard against NaN + if target ~= target then + return + end + self._target = target local torso = self:GetTorso() diff --git a/Modules/Server/Particles/ParticleEngineServer.lua b/Modules/Server/Particles/ParticleEngineServer.lua index 8e05674de1c..89865d2fc47 100644 --- a/Modules/Server/Particles/ParticleEngineServer.lua +++ b/Modules/Server/Particles/ParticleEngineServer.lua @@ -33,10 +33,10 @@ function ParticleEngineServer:ParticleNew(p) assert(self._remoteEvent) p.Position = p.Position or error("No Position") - p.Velocity = p.Velocity or Vector3.new() + p.Velocity = p.Velocity or Vector3.zero p.Size = p.Size or Vector2.new(0.2,0.2) p.Bloom = p.Bloom or Vector2.new(0,0) - p.Gravity = p.Gravity or Vector3.new() + p.Gravity = p.Gravity or Vector3.zero p.LifeTime = p.LifeTime; p.Color = p.Color or Color3.new(1,1,1) p.Transparency = p.Transparency or 0.5 diff --git a/Modules/Shared/CFrame/AxisAngleUtils.lua b/Modules/Shared/CFrame/AxisAngleUtils.lua index 6571647f152..041df0bb448 100644 --- a/Modules/Shared/CFrame/AxisAngleUtils.lua +++ b/Modules/Shared/CFrame/AxisAngleUtils.lua @@ -12,7 +12,7 @@ function AxisAngleUtils.toCFrame(axisAngle, position) if position then return CFrame.new(position) else - return CFrame.new() + return CFrame.identity end end @@ -29,7 +29,7 @@ function AxisAngleUtils.fromCFrame(cframe) if axisAngle ~= axisAngle then -- warn("[AxisAngleUtils.fromCFrame] - axisAngle is NAN") - return Vector3.new(0, 0, 0), cframe.Position + return Vector3.zero, cframe.Position end return axisAngle, cframe.Position diff --git a/Modules/Shared/CFrame/SurfaceUtils.lua b/Modules/Shared/CFrame/SurfaceUtils.lua index 5f251286e47..b102d33566e 100644 --- a/Modules/Shared/CFrame/SurfaceUtils.lua +++ b/Modules/Shared/CFrame/SurfaceUtils.lua @@ -3,14 +3,14 @@ local SurfaceUtils = {} -local UP = Vector3.new(0, 1, 0) -local BACK = Vector3.new(0, 0, 1) +local UP = Vector3.yAxis +local BACK = Vector3.zAxis local EXTRASPIN = CFrame.fromEulerAnglesXYZ(math.pi/2, 0, 0) local function getTranstionBetween(v1, v2, pitchAxis) local dot = v1:Dot(v2) if (dot > 0.99999) then - return CFrame.new() + return CFrame.identity elseif (dot < -0.99999) then return CFrame.fromAxisAngle(pitchAxis, math.pi) end diff --git a/Modules/Shared/CFrame/getRotationInXZPlane.lua b/Modules/Shared/CFrame/getRotationInXZPlane.lua index 9cabb408087..d9e05969862 100644 --- a/Modules/Shared/CFrame/getRotationInXZPlane.lua +++ b/Modules/Shared/CFrame/getRotationInXZPlane.lua @@ -15,7 +15,7 @@ return function(cframe) return cframe -- we're looking straight down end - local top = Vector3.new(0, 1, 0) + local top = Vector3.yAxis local right = top:Cross(back) return CFrame.new( diff --git a/Modules/Shared/Character/HumanoidTeleportUtils.lua b/Modules/Shared/Character/HumanoidTeleportUtils.lua index 3dcd2d2ee66..7047aaacfc7 100644 --- a/Modules/Shared/Character/HumanoidTeleportUtils.lua +++ b/Modules/Shared/Character/HumanoidTeleportUtils.lua @@ -28,7 +28,7 @@ function HumanoidTeleportUtils.identifySafePosition(position, raycaster) local hitData = raycaster:FindPartOnRay(Ray.new(origin, direction)) if not hitData then - local secondHit = raycaster:FindPartOnRay(Ray.new(origin+direction - Vector3.new(0, 1, 0), -direction)) + local secondHit = raycaster:FindPartOnRay(Ray.new(origin+direction - Vector3.yAxis, -direction)) -- try to identify flat surface if secondHit then diff --git a/Modules/Shared/Collision/PartTouchingCalculator.lua b/Modules/Shared/Collision/PartTouchingCalculator.lua index 4b316fdeb7a..344c2d82b3e 100644 --- a/Modules/Shared/Collision/PartTouchingCalculator.lua +++ b/Modules/Shared/Collision/PartTouchingCalculator.lua @@ -74,7 +74,7 @@ function PartTouchingCalculator:CheckIfTouchingHumanoid(humanoid, parts) end function PartTouchingCalculator:GetCollidingPartFromParts(parts, relativeTo, padding) - relativeTo = relativeTo or CFrame.new() + relativeTo = relativeTo or CFrame.identity local size, position = BoundingBoxUtils.getPartsBoundingBox(parts, relativeTo) diff --git a/Modules/Shared/Debug/Draw.lua b/Modules/Shared/Debug/Draw.lua index 7fd9b27877f..5a1445b31bd 100644 --- a/Modules/Shared/Debug/Draw.lua +++ b/Modules/Shared/Debug/Draw.lua @@ -64,7 +64,7 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter) rotatedPart.CastShadow = false rotatedPart.CFrame = CFrame.new(ray.Origin, ray.Origin + ray.Direction) rotatedPart.Transparency = 1 - rotatedPart.Size = Vector3.new(1, 1, 1) + rotatedPart.Size = Vector3.one rotatedPart.Parent = part local lineHandleAdornment = Instance.new("LineHandleAdornment") @@ -78,7 +78,7 @@ function Draw.ray(ray, color, parent, meshDiameter, diameter) lineHandleAdornment.Parent = rotatedPart local mesh = Instance.new("SpecialMesh") - mesh.Scale = Vector3.new(0, 1, 0) + Vector3.new(meshDiameter, 0, meshDiameter) / diameter + mesh.Scale = Vector3.yAxis + Vector3.new(meshDiameter, 0, meshDiameter) / diameter mesh.Parent = part part.Parent = parent @@ -110,7 +110,7 @@ function Draw._textOnAdornee(adornee, text, color) local billboardGui = Instance.new("BillboardGui") billboardGui.Name = "DebugBillboardGui" billboardGui.SizeOffset = Vector2.new(0, 0.5) - billboardGui.ExtentsOffset = Vector3.new(0, 1, 0) + billboardGui.ExtentsOffset = Vector3.yAxis billboardGui.AlwaysOnTop = true billboardGui.Adornee = adornee billboardGui.StudsOffset = Vector3.new(0, 0, 0.01) diff --git a/Modules/Shared/Geometry/BoundingBoxUtils.lua b/Modules/Shared/Geometry/BoundingBoxUtils.lua index 19e2c128181..b3d8d12830a 100644 --- a/Modules/Shared/Geometry/BoundingBoxUtils.lua +++ b/Modules/Shared/Geometry/BoundingBoxUtils.lua @@ -60,12 +60,12 @@ end --- Gets a boundingBox for the given data -- @param data List of things with both Size and CFrame --- @tparam[opt=CFrame.new()] relativeTo +-- @tparam[opt=CFrame.identity] relativeTo -- @treturn Vector3 Size -- @treturn Position position -- https://gist.github.com/zeux/1a67e8930df782d5474276e218831e22 function BoundingBoxUtils.getBoundingBox(data, relativeTo) - relativeTo = relativeTo or CFrame.new() + relativeTo = relativeTo or CFrame.identity local abs = math.abs local inf = math.huge diff --git a/Modules/Shared/Geometry/PartGeometry.lua b/Modules/Shared/Geometry/PartGeometry.lua index 74701b8e4ce..e530ff3cab6 100644 --- a/Modules/Shared/Geometry/PartGeometry.lua +++ b/Modules/Shared/Geometry/PartGeometry.lua @@ -27,7 +27,7 @@ local function IsSmoothPart(part) return part:IsA("Part") and (part.Shape == Enum.PartType.Ball) end -local UNIFORM_SCALE = Vector3.new(1, 1, 1) +local UNIFORM_SCALE = Vector3.one local function GetShape(part) for _, ch in pairs(part:GetChildren()) do if ch:IsA("SpecialMesh") then @@ -234,7 +234,7 @@ function PartGeometry.getGeometry(part, hit, cframeOverride) -- } -- -- local xvec = CFrame.Angles(0, math.pi/2*(orientToNumberMap[orient]-1), 0).lookVector - -- local yvec = Vector3.new(0, 1, 0) + -- local yvec = Vector3.yAxis -- local zvec = xvec:Cross(yvec) -- if block == Enum.CellBlock.Solid then diff --git a/Modules/Shared/Geometry/ScaleModel.lua b/Modules/Shared/Geometry/ScaleModel.lua index ba58401cb50..2370f91cf18 100644 --- a/Modules/Shared/Geometry/ScaleModel.lua +++ b/Modules/Shared/Geometry/ScaleModel.lua @@ -5,7 +5,7 @@ local ScaleModel = {} local CLASS_NAME_TO_MIN_SIZE = { ["TrussPart"] = Vector3.new(2, 2, 2); - ["UnionOperation"] = Vector3.new(0, 0, 0); + ["UnionOperation"] = Vector3.zero; } local MIN_PART_SIZE = Vector3.new(0.05, 0.05, 0.05) diff --git a/Modules/Shared/IK/Arm/ArmFABRIKBase.lua b/Modules/Shared/IK/Arm/ArmFABRIKBase.lua index 1f8c499e61e..3d1b149d667 100644 --- a/Modules/Shared/IK/Arm/ArmFABRIKBase.lua +++ b/Modules/Shared/IK/Arm/ArmFABRIKBase.lua @@ -293,7 +293,7 @@ function ArmFABRIKBase:_rebuildChain() }; }) - local chain = FABRIKChain.fromPointsConstraints(CFrame.new(), points, { + local chain = FABRIKChain.fromPointsConstraints(CFrame.identity, points, { FABRIKShoulderConstraint.new(); FABRIKElbowConstraint.new(); FABRIKHandConstraint.new(); diff --git a/Modules/Shared/IK/Arm/ArmIKBase.lua b/Modules/Shared/IK/Arm/ArmIKBase.lua index a25470fb62b..e06533bd0ba 100644 --- a/Modules/Shared/IK/Arm/ArmIKBase.lua +++ b/Modules/Shared/IK/Arm/ArmIKBase.lua @@ -137,7 +137,7 @@ function ArmIKBase:Update() local shoulderXAngle = self._shoulderXAngle local elbowXAngle = self._elbowXAngle - local yrot = CFrame.new(Vector3.new(), self._offset) + local yrot = CFrame.new(Vector3.zero, self._offset) self._shoulderTransform = (yrot * CFA_90X * CFrame.Angles(shoulderXAngle, 0, 0)) --:inverse() self._elbowTransform = CFrame.Angles(elbowXAngle, 0, 0) diff --git a/Modules/Shared/IK/FABRIK/FABRIKBone.lua b/Modules/Shared/IK/FABRIK/FABRIKBone.lua index 97a29c45454..8a92758b20e 100644 --- a/Modules/Shared/IK/FABRIK/FABRIKBone.lua +++ b/Modules/Shared/IK/FABRIK/FABRIKBone.lua @@ -1,7 +1,7 @@ --- -- @classmod FABRIKBone -local UNIT_NZ = Vector3.new(0, 0, -1) +local UNIT_NZ = -Vector3.zAxis local function getRotationBetween(u, v, axis) local dot, uxv = u:Dot(v), u:Cross(v) diff --git a/Modules/Shared/IK/FABRIK/FABRIKChain.lua b/Modules/Shared/IK/FABRIK/FABRIKChain.lua index 0c2eec6127d..47bc1274ea3 100644 --- a/Modules/Shared/IK/FABRIK/FABRIKChain.lua +++ b/Modules/Shared/IK/FABRIK/FABRIKChain.lua @@ -6,7 +6,7 @@ local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Never local FABRIKVertex = require("FABRIKVertex") local FABRIKBone = require("FABRIKBone") -local UNIT_NZ = Vector3.new(0, 0, -1) +local UNIT_NZ = -Vector3.zAxis local BREAK_COUNT = 20 local TOLERANCE = 0.02 diff --git a/Modules/Shared/InputImageLibrary/Spritesheets/Guestures/All.lua b/Modules/Shared/InputImageLibrary/Spritesheets/Guestures/All.lua index e8643fe9e31..cb5c7e0a75d 100644 --- a/Modules/Shared/InputImageLibrary/Spritesheets/Guestures/All.lua +++ b/Modules/Shared/InputImageLibrary/Spritesheets/Guestures/All.lua @@ -11,7 +11,7 @@ Gestures.__index = Gestures function Gestures.new() local self = setmetatable(Spritesheet.new("rbxassetid://1244652786"), Gestures) - self:AddSprite("DoubleRotate", Vector2.new(0, 0), Vector2.new(102, 139)) + self:AddSprite("DoubleRotate", Vector2.zero, Vector2.new(102, 139)) self:AddSprite("DoubleTap", Vector2.new(102, 0), Vector2.new(100, 100)) self:AddSprite("FingerFront", Vector2.new(202, 0), Vector2.new(100, 100)) self:AddSprite("FingerSide", Vector2.new(302, 0), Vector2.new(100, 100)) diff --git a/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Dark.lua b/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Dark.lua index b5d71c57d4f..a2b4e03c954 100644 --- a/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Dark.lua +++ b/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Dark.lua @@ -11,7 +11,7 @@ KeyboardDark.__index = KeyboardDark function KeyboardDark.new() local self = setmetatable(Spritesheet.new("rbxassetid://1244652930"), KeyboardDark) - self:AddSprite("BackspaceAlt", Vector2.new(0, 0), Vector2.new(100, 100)) + self:AddSprite("BackspaceAlt", Vector2.zero, Vector2.new(100, 100)) self:AddSprite("Command", Vector2.new(100, 0), Vector2.new(100, 100)) self:AddSprite("Eleven", Vector2.new(200, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.Return, Vector2.new(300, 0), Vector2.new(100, 100)) diff --git a/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Light.lua b/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Light.lua index ed4f417d7da..a53659e03c7 100644 --- a/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Light.lua +++ b/Modules/Shared/InputImageLibrary/Spritesheets/Keyboard/Light.lua @@ -11,7 +11,7 @@ KeyboardLight.__index = KeyboardLight function KeyboardLight.new() local self = setmetatable(Spritesheet.new("rbxassetid://1244653012"), KeyboardLight) - self:AddSprite("BackspaceAlt", Vector2.new(0, 0), Vector2.new(100, 100)) + self:AddSprite("BackspaceAlt", Vector2.zero, Vector2.new(100, 100)) self:AddSprite("Command", Vector2.new(100, 0), Vector2.new(100, 100)) self:AddSprite("Eleven", Vector2.new(200, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.Return, Vector2.new(300, 0), Vector2.new(100, 100)) diff --git a/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Dark.lua b/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Dark.lua index a0a6073c53c..78ab479a3d3 100644 --- a/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Dark.lua +++ b/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Dark.lua @@ -11,7 +11,7 @@ XboxOneDark.__index = XboxOneDark function XboxOneDark.new() local self = setmetatable(Spritesheet.new("rbxassetid://5089898851"), XboxOneDark) - self:AddSprite("DPad", Vector2.new(0, 0), Vector2.new(100, 100)) + self:AddSprite("DPad", Vector2.zero, Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonA, Vector2.new(100, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonB, Vector2.new(200, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonL1, Vector2.new(300, 0), Vector2.new(100, 100)) diff --git a/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Light.lua b/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Light.lua index 332f40da5e5..c0092b3eb9e 100644 --- a/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Light.lua +++ b/Modules/Shared/InputImageLibrary/Spritesheets/XboxOne/Light.lua @@ -12,7 +12,7 @@ XboxOneLight.__index = XboxOneLight function XboxOneLight.new() local self = setmetatable(Spritesheet.new("rbxassetid://5104051626"), XboxOneLight) - self:AddSprite("DPad", Vector2.new(0, 0), Vector2.new(100, 100)) + self:AddSprite("DPad", Vector2.zero, Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonA, Vector2.new(100, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonB, Vector2.new(200, 0), Vector2.new(100, 100)) self:AddSprite(Enum.KeyCode.ButtonL1, Vector2.new(300, 0), Vector2.new(100, 100)) diff --git a/Modules/Shared/Joint/Joint.lua b/Modules/Shared/Joint/Joint.lua index 70c971d96c5..1c3ce0b3723 100644 --- a/Modules/Shared/Joint/Joint.lua +++ b/Modules/Shared/Joint/Joint.lua @@ -13,7 +13,7 @@ function Joint.Weld(part0, part1, jointType, parent) local weld = Instance.new(jointType or "Weld") weld.Part0 = part0 weld.Part1 = part1 - weld.C0 = CFrame.new() + weld.C0 = CFrame.identity weld.C1 = part1.CFrame:ToObjectSpace(part0.CFrame) weld.Parent = parent or part0 diff --git a/Modules/Shared/Legacy/qGUI.lua b/Modules/Shared/Legacy/qGUI.lua index a58bc165953..e4a28f90313 100644 --- a/Modules/Shared/Legacy/qGUI.lua +++ b/Modules/Shared/Legacy/qGUI.lua @@ -350,7 +350,7 @@ local function AddNinePatch(Frame, Image, ImageSize, Radius, Type, Properties) MiddleRight.ImageRectOffset = Vector2.new(ImageSize.X * (2/3), ImageSize.Y/3) BottomRight.ImageRectOffset = Vector2.new(ImageSize.X * (2/3), ImageSize.Y * (2/3)) - --TopLeft.ImageRectOffset = Vector2.new(0, 0) + --TopLeft.ImageRectOffset = Vector2.zero MiddleLeft.ImageRectOffset = Vector2.new(0, ImageSize.Y/3) BottomLeft.ImageRectOffset = Vector2.new(0, ImageSize.Y * (2/3)) diff --git a/Modules/Shared/Lighting/SunPositionUtils.lua b/Modules/Shared/Lighting/SunPositionUtils.lua index e9a2eb48056..4dbc93df366 100644 --- a/Modules/Shared/Lighting/SunPositionUtils.lua +++ b/Modules/Shared/Lighting/SunPositionUtils.lua @@ -4,7 +4,7 @@ local SunPositionUtils = {} local EARTH_TILT = 23.5 -local NORTH = Vector3.new(0, 0, -1) +local NORTH = -Vector3.zAxis function SunPositionUtils.getGeographicalLatitudeFromDirection(direction) local angle = math.atan2(direction.z, math.sqrt(direction.x^2 + direction.y^2)) diff --git a/Modules/Shared/Markdown/MarkdownRender.lua b/Modules/Shared/Markdown/MarkdownRender.lua index 56dbeab4d39..343c35f8dfc 100644 --- a/Modules/Shared/Markdown/MarkdownRender.lua +++ b/Modules/Shared/Markdown/MarkdownRender.lua @@ -209,7 +209,7 @@ function MarkdownRender:_renderHeader(headerData) underline.BackgroundTransparency = 0 underline.BackgroundColor3 = Color3.new(0.9, 0.9, 0.9) underline.Size = UDim2.new(1, 0, 0, 1) - underline.AnchorPoint = Vector2.new(0, 1) + underline.AnchorPoint = Vector2.yAxis underline.Position = UDim2.new(0, 0, 1, 0) underline.Parent = label diff --git a/Modules/Shared/Physics/Constraints/WeldConstraintUtils.lua b/Modules/Shared/Physics/Constraints/WeldConstraintUtils.lua index cc5c240d9b1..ff76b12490e 100644 --- a/Modules/Shared/Physics/Constraints/WeldConstraintUtils.lua +++ b/Modules/Shared/Physics/Constraints/WeldConstraintUtils.lua @@ -21,7 +21,7 @@ function WeldConstraintUtils.namedBetween(name, part0, part1, parent) weld.Name = name weld.Part0 = part0 weld.Part1 = part1 - weld.C0 = CFrame.new() + weld.C0 = CFrame.identity weld.C1 = part1.CFrame:ToObjectSpace(part0.CFrame) weld.Parent = parent diff --git a/Modules/Shared/Physics/PhysicsUtils.lua b/Modules/Shared/Physics/PhysicsUtils.lua index e73f3337a39..23e1db99dcc 100644 --- a/Modules/Shared/Physics/PhysicsUtils.lua +++ b/Modules/Shared/Physics/PhysicsUtils.lua @@ -46,7 +46,7 @@ end -- Lots of help from Hippalectryon :D function PhysicsUtils.getCenterOfMass(parts) local mass = 0 - local weightedSum = Vector3.new(0, 0, 0) + local weightedSum = Vector3.zero for _, part in pairs(parts) do -- part.BrickColor = BrickColor.new("Bright yellow") @@ -112,7 +112,7 @@ function PhysicsUtils.applyForce(part, force, forcePosition) if momentOfInertia ~= 0 then rotAcceleration = torque/momentOfInertia else - rotAcceleration = Vector3.new(0, 0, 0) -- We cannot divide by 0 + rotAcceleration = Vector3.zero-- We cannot divide by 0 end local acceleration = force/mass diff --git a/Modules/Shared/Physics/Projectiles/MinEntranceVelocityUtils.lua b/Modules/Shared/Physics/Projectiles/MinEntranceVelocityUtils.lua index 801a39d3416..b9b9ed8fb35 100644 --- a/Modules/Shared/Physics/Projectiles/MinEntranceVelocityUtils.lua +++ b/Modules/Shared/Physics/Projectiles/MinEntranceVelocityUtils.lua @@ -14,7 +14,7 @@ function MinEntranceVelocityUtils.minimizeEntranceVelocity(origin, target, accel local lowerTerm = math.sqrt(2 * accelDist * offsetDist) if lowerTerm == 0 then - return Vector3.new(0, 0, 0) + return Vector3.zero end return (accelDist*offset - accel*offsetDist) / lowerTerm diff --git a/Modules/Shared/Physics/Spring.lua b/Modules/Shared/Physics/Spring.lua index 657cd0e0014..09d75477c74 100644 --- a/Modules/Shared/Physics/Spring.lua +++ b/Modules/Shared/Physics/Spring.lua @@ -123,7 +123,7 @@ function Spring:__newindex(index, value) local position, velocity = self:_positionVelocity(now) self._position0 = position self._velocity0 = velocity - self._damper = math.clamp(value, 0, 1) + self._damper = value self._time0 = now elseif index == "Speed" or index == "s" then local position, velocity = self:_positionVelocity(now) diff --git a/Modules/Shared/Physics/SpringUtils.lua b/Modules/Shared/Physics/SpringUtils.lua index 997b0055adc..7f6f6c1f57f 100644 --- a/Modules/Shared/Physics/SpringUtils.lua +++ b/Modules/Shared/Physics/SpringUtils.lua @@ -32,7 +32,7 @@ function SpringUtils.animating(spring, epsilon) end -- Add to spring position to adjust for velocity of target. May have to set clock to time(). -function SpringUtils.getVelocityAdjustment(position, velocity, dampen, speed) +function SpringUtils.getVelocityAdjustment(velocity, dampen, speed) return velocity*(2*dampen/speed) end diff --git a/Modules/Shared/Ragdoll/Classes/BindableRagdollHumanoidOnFall.lua b/Modules/Shared/Ragdoll/Classes/BindableRagdollHumanoidOnFall.lua index 4ddab7cbcf2..14c06a3fe02 100644 --- a/Modules/Shared/Ragdoll/Classes/BindableRagdollHumanoidOnFall.lua +++ b/Modules/Shared/Ragdoll/Classes/BindableRagdollHumanoidOnFall.lua @@ -53,7 +53,7 @@ end function BindableRagdollHumanoidOnFall:_initLastVelocityRecords() self._lastVelocityRecords = {} for _ = 1, FRAMES_TO_EXAMINE + 1 do -- Add an extra frame because we remove before inserting - table.insert(self._lastVelocityRecords, Vector3.new()) + table.insert(self._lastVelocityRecords, Vector3.zero) end end @@ -95,7 +95,7 @@ function BindableRagdollHumanoidOnFall:_updateVelocity() local rootPart = self._obj.RootPart if not rootPart then - table.insert(self._lastVelocityRecords, Vector3.new()) + table.insert(self._lastVelocityRecords, Vector3.zero) return end diff --git a/Modules/Shared/Ragdoll/RagdollRigging.lua b/Modules/Shared/Ragdoll/RagdollRigging.lua index ada5ccea1ef..f0bfabdf76a 100644 --- a/Modules/Shared/Ragdoll/RagdollRigging.lua +++ b/Modules/Shared/Ragdoll/RagdollRigging.lua @@ -91,11 +91,11 @@ local R6_HIP_LIMITS = { TwistUpperAngle = 80, } -local V3_ZERO = Vector3.new() -local V3_UP = Vector3.new(0, 1, 0) -local V3_DOWN = Vector3.new(0, -1, 0) -local V3_RIGHT = Vector3.new(1, 0, 0) -local V3_LEFT = Vector3.new(-1, 0, 0) +local V3_ZERO = Vector3.zero +local V3_UP = Vector3.yAxis +local V3_DOWN = -Vector3.yAxis +local V3_RIGHT = Vector3.xAxis +local V3_LEFT = -Vector3.xAxis -- To model shoulder cone and twist limits correctly we really need the primary axis of the UpperArm -- to be going down the limb. the waist and neck joints attachments actually have the same problem diff --git a/Modules/Shared/Ragdoll/RagdollUtils.lua b/Modules/Shared/Ragdoll/RagdollUtils.lua index 2d431593771..4ee0ca2a967 100644 --- a/Modules/Shared/Ragdoll/RagdollUtils.lua +++ b/Modules/Shared/Ragdoll/RagdollUtils.lua @@ -206,7 +206,7 @@ function RagdollUtils.setupHead(humanoid) :Subscribe(function(headScale) lastHeadScale = headScale - head.Size = Vector3.new(1, 1, 1)*headScale + head.Size = Vector3.one * headScale end)) -- Cleanup and reset head scale diff --git a/Modules/Shared/Utility/CFrameUtils.lua b/Modules/Shared/Utility/CFrameUtils.lua index 9cb2955c921..ad438e68bd9 100644 --- a/Modules/Shared/Utility/CFrameUtils.lua +++ b/Modules/Shared/Utility/CFrameUtils.lua @@ -2,7 +2,7 @@ -- @module CFrameUtils -- @author Quenty -local UP = Vector3.new(0, 1, 0) +local UP = Vector3.yAxis local CFrameUtils = {}