Advertisement
This is comment for paste
Blackhole v5.0 Prototype
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- [ Blackhole 5.0 Source Code Prototype ] --
- -- DEV VERSION - Experimental use only
- local hole = script.Parent
- local gravitationalConstant = 1000
- local updateInterval = 0
- local damping = 0.7
- local rangeFactor = 250
- local transparencySteps = {0.25, 0.5, 0.75}
- local dematerializeDuration = 0.01
- local partColor = BrickColor.new(0)
- local partMaterialTransform = Enum.Material.Neon
- local collision = true
- local fixedPosition = false
- local lastUpdateTime = 0
- local function ApplyGravity(object)
- local currentTime = tick()
- if currentTime - lastUpdateTime < updateInterval then return end
- lastUpdateTime = currentTime
- local direction = hole.Position - object.Position
- local distance = direction.Magnitude
- local distanceSquared = ((distance*6400) / (rangeFactor*65)) ^ 2
- local magnitude = gravitationalConstant / distanceSquared
- local force = direction.Unit * magnitude * object:GetMass()
- local bodyForce = object:FindFirstChild("BlackHoleBodyForce")
- if not bodyForce then
- bodyForce = Instance.new("BodyForce")
- bodyForce.Name = "BlackHoleBodyForce"
- bodyForce.Force = Vector3.new(0, 0, 0)
- bodyForce.Parent = object
- end
- bodyForce.Force = (bodyForce.Force + force) * damping
- end
- local function CheckAndApplyGravity(obj)
- if not obj:IsDescendantOf(game.Workspace) or not obj:IsA("BasePart") then
- return
- end
- if obj == hole or obj.Parent:IsA("Player") then
- return
- end
- if obj.Anchored then
- return
- end
- ApplyGravity(obj)
- end
- game:GetService("RunService").Heartbeat:Connect(function()
- for _, object in pairs(game.Workspace:GetDescendants()) do
- CheckAndApplyGravity(object)
- end
- end)
- function onTouched(part)
- part.BrickColor = partColor
- part.Material = partMaterialTransform
- part.CanCollide = collision
- part.Anchored = fixedPosition
- for _, transparency in ipairs(transparencySteps) do
- part.Transparency = transparency
- wait(dematerializeDuration)
- end
- part:Destroy()
- end
- --[
- local connection = hole.Touched:Connect(onTouched)
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement