null
nil
-
0
0
0
1
0
0
0
1
0
0
0
1
PhysicsAnalyzerPlugin
[null]
-
false
PhysicsAnalyzerScript
1 ) then
label = label .. " / "
end
label = label .. issue[j].Name
end
local item = ItemTemplate:Clone()
item.Parent = Canvas
item.Position = UDim2.new(0, 0, 0, 21 * #issues)
item.Text = label
local itemConnection = item.InputBegan:connect(function(evt)
if evt.UserInputType == Enum.UserInputType.MouseButton1 then
moveAndSelectParts(issue)
end
end)
item.Visible = true
issues[#issues + 1] = {issue, item, itemConnection}
ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, #issues * 21)
if (ScrollingFrame.CanvasSize.Y.Offset > ScrollingFrame.AbsoluteSize.Y) then
Canvas.Size = UDim2.new(1, -16, 1, 0)
else
Canvas.Size = UDim2.new(1, 0, 1, 0)
end
previousIssueCount = #issues;
end
function moveAndSelectParts(parts)
game.Selection:Set(parts)
local extents = Extent.getExtents(parts)
Camera.zoomToExtents(extents)
end
local function gotIssues(count)
MainFrame.Size = UDim2.new(0, 200, 0, 200)
ScrollingFrame.Visible = true
if (count == previousIssueCount) then
return
end
clearAllIssues()
RunService:Pause()
game.Workspace:SetPhysicsAnalyzerBreakOnIssue(true)
--Updating GUI
NumberFound.Text = count .. " overconstraints detected"
RunButton.Visible = true
CurrentStatus.Text = "Paused"
for i = 0, count - 1 do
local issue = game.Workspace:GetPhysicsAnalyzerIssue(i)
addIssue(issue)
end
game.Workspace:SetPhysicsAnalyzerBreakOnIssue(false)
end
local function connectEvents()
RunServiceSteppedSignal = RunService.Stepped:connect(function()
clearAllIssues()
CurrentStatus.Text = "Running"
end)
RunButtonInputSignal = RunButton.InputBegan:connect(function(evt)
if (evt.UserInputType == Enum.UserInputType.MouseButton1) then
RunService:Run()
RunButton.Visible = false
end
end)
HelpButtonSignal = HelpButton.InputBegan:connect(function(evt)
if (evt.UserInputType == Enum.UserInputType.MouseButton1) then
plugin:OpenWikiPage("Physics_Analyzer")
end
end)
PhysicsAnalyzerIssuesSignal = game.Workspace.PhysicsAnalyzerIssuesFound:connect(gotIssues)
end
local function disconnectEvents()
if PhysicsAnalyzerIssuesSignal then
PhysicsAnalyzerIssuesSignal:disconnect()
end
if RunServiceSteppedSignal then
RunServiceSteppedSignal:disconnect()
end
if RunButtonInputSignal then
RunButtonInputSignal:disconnect()
end
if HelpButtonSignal then
HelpButtonSignal:disconnect()
end
end
local function physicsAnalyzerEnabled(enabled)
MainFrame.Visible = enabled
if enabled then
connectEvents()
else
disconnectEvents()
end
end
----------
--EVENTS--
----------
settings().Physics.Changed:connect(function(itemChanged)
if itemChanged == "PhysicsAnalyzerEnabled" then
physicsAnalyzerEnabled(settings().Physics.PhysicsAnalyzerEnabled)
end
end)
physicsAnalyzerEnabled(settings().Physics.PhysicsAnalyzerEnabled)
]]>
-
Extent
extents.max.x then extents.max = Vector3.new(point.x, extents.max.y, extents.max.z) end
if point.y > extents.max.y then extents.max = Vector3.new(extents.max.x, point.y, extents.max.z) end
if point.z > extents.max.z then extents.max = Vector3.new(extents.max.x, extents.max.y, point.z) end
end
end
end
return extents
end
local function addToExtents(extents, part)
for i = 0, 7 do
local corner = (Vector3.new(math.floor(i / 4), math.floor(i / 2) % 2, i % 2) * 2) - Vector3.new(1, 1, 1)
local worldPosition = part.CFrame:pointToWorldSpace(corner * part.Size)
extents.addPoint(worldPosition)
end
return extents
end
local function getExtents(parts)
local extents = createExtents()
for i = 1, #parts do
if parts[i]:IsA("BasePart") then
extents = addToExtents(extents, parts[i])
end
end
return extents
end
-----------------
--ENCAPSULATION--
-----------------
local module = {}
module.getExtents = getExtents
return module
]]>
-
Camera
-
PhysicsAnalyzerGui
-
true
4294967295
0
4279970357
1
false
false
MainFrame
[null]
[null]
[null]
[null]
0
0
0
0
0
false
[null]
0
200
0
70
0
6
true
1
-
false
4294967295
0.75
4279970357
0
false
false
4
6
TitleLabel
[null]
[null]
[null]
[null]
0
0
0
0
0
false
[null]
1
0
0
25
0
Physics Analyzer
4294967295
false
4278190080
1
0
false
2
1
true
1
-
false
4294967295
1
4279970357
0
ayaasset://textures/ui/studs.png
0
0
0
0
0
100
true
false
ayaasset://textures/ui/smooth.png
ScrollingFrame
[null]
[null]
[null]
[null]
0
0
0
75
0
12
true
true
[null]
1
0
1
-75
0
ayaasset://textures/ui/studs.png
false
1
-
false
4294967295
1
4279970357
0
true
false
Canvas
[null]
[null]
[null]
[null]
0
0
0
0
0
false
[null]
1
-16
1
0
0
0
true
1
-
true
true
4294967295
0.899999976
4279970357
0
false
false
3
5
false
ItemTemplate
[null]
[null]
[null]
[null]
0
0
0
0
0
true
false
[null]
1
0
0
20
0
0
Problem 0
4294967295
false
4278190080
1
0
false
2
1
false
1
-
false
4294967295
1
4279970357
0
false
false
4
5
Status
[null]
[null]
[null]
[null]
0
0
0
30
0
false
[null]
0
50
0
20
0
Status:
4294967295
false
4278190080
1
0
false
2
1
true
1
-
false
4294967295
1
4279970357
0
false
false
3
5
CurrentStatus
[null]
[null]
[null]
[null]
0
47
0
31
0
false
[null]
0
50
0
20
0
Ready
4294967295
false
4278190080
1
0
false
0
1
true
1
-
false
4294967295
1
4279970357
0
false
false
4
5
NumberFound
[null]
[null]
[null]
[null]
0
5
0
55
0
false
[null]
1
-5
0
20
0
4294924122
false
4278190080
1
0
false
0
1
true
1
-
true
true
4294967295
1
4279970357
0
false
false
roblox.com/asset?id=358274726
4294967295
0
0
0
0
0
false
RunButton
[null]
[null]
[null]
[null]
1
-25
0
30
0
0
true
false
[null]
0
20
0
20
0
0
0
0
0
0
false
1
-
true
true
4294967295
1
4279970357
0
false
false
roblox.com/asset?id=320903644
4294967295
0
0
0
0
0
false
HelpButton
[null]
[null]
[null]
[null]
1
-19
0
4
0
0
true
false
[null]
0
16
0
16
0
0
0
0
0
0
true
1