Advertisement
1m1m0

Blackhole v5.0 ALPHA

Dec 17th, 2024 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.74 KB | Source Code | 0 0
  1. -- [ Blackhole 5.0 Alpha Release 4 ] --
  2. -- Integrated smoother BodyForce-based graviaty for stable simulations.
  3. -- Archived versions - visit my pastebin: https://pastebin.com/u/1m1m0
  4.  
  5. local hole = script.Parent --                       Quick Docs, more at `Documentation`
  6. local gravitationalConstant = 1000                  -- Adjust this value to control the strength of the attraction [1000 is default for a black hole]
  7. local updateInterval = 0                            -- Time in seconds between updates while computing (Higher = +Accuracy -Performance, Lower = -Accuracy +Performance)
  8. local damping = 0.7                                 -- Adjust this value to control the rate of force application [1 is no damping, 0.7 is a suggested starting point]
  9. local rangeFactor = 500                             -- Maximum range for objects to be effected [500 studs is default]
  10. local transparencySteps = {0.25, 0.5, 0.75}         -- Transparency changes. (Appearing to fade out of reality)
  11. local dematerializeDuration = 0.01                  -- How long (seconds) the fading will last (In seconds) on each transparency increment
  12. local sizeProportion = 42                           -- Smaller = faster growth for each absorption !! CANNOT BE 0 (ZERO) !!
  13. local rangeProportion = 125                         -- Bigger = faster range growth
  14. local partColor = BrickColor.new(0)                 -- Color it changes into before getting deleted. (White is default)
  15. local partMaterialTransform = Enum.Material.Neon    -- Material it changes into before getting deleted. (Neon is default)
  16. local absorption = true                             -- Absorb objects that touch the blackhole
  17. local growth = true                                 -- Allow the blackhole to grow by absorption
  18. local killPlayers = true                            -- Kill players that touch the blackhole !(disable when merging a lot of blackholes!)!
  19. local collision = false                             -- Make objects pass through eachother while being absorbed
  20. local fixedPosition = true                          -- Anchor objects while being absorbed (Better FPS)
  21. local toggleMicroGravity = false                    -- This script works best in zero gravity environments! (Optional)
  22. -- Beta Parameters --                               Latest Feature Additions Preview
  23. local infinityHandler = true                        -- Prevents objects from reaching infinite velocity
  24. local paradoxHandler = false                        -- Prevents two or more blackholes from absorbing eachother when touching
  25. local mergeBlackholes = true                        -- Merge blackholes based on size
  26. local gravityEngine = "bodyforce"                   -- Switch between BodyForce and Velocity-based gravitational attraction (1 or 2 if youre lazy)
  27. local glint = hole.VFX.Glint                        -- Particle emitter, must be changed when path or name is also changed
  28. local glintProportion = 1.5                         -- Factor on glint growing proportionally to the blackhole for realism (multiplication. to divide, use fractions)
  29. local rocheLimitFactor = 3                          -- Multiplier for the black hole's radius to define the Roche limit (area of deconstruction on welds and joints)
  30. local gravitySync = true                            -- Toggle to syncrhonize velocity-based gravity with force-based. Velocity-based gravity is violent!
  31.  
  32. -- GRAVITATIONAL FORCES --
  33.  
  34. local lastUpdateTime = 0
  35. local CollectionService = game:GetService("CollectionService")
  36. local previousSize = hole.Size.X
  37. local glintProportions = previousSize * glintProportion
  38.  
  39. -- Logger and error handler [WIP]
  40. local logger = {
  41.     bodyForce = false,
  42.     velocity = false,
  43.     sizeProp = false,
  44.     zeroGrav = false,
  45.     consuming = false,
  46.     gravEngine = false
  47. }
  48.  
  49. -- Roche Limit, or in normal person terms, the point where objects decontruct due to its proximity
  50. local function DestroyJointsWithinRocheLimit(object)
  51.     local direction = hole.Position - object.Position
  52.     local distance = direction.Magnitude
  53.     local rocheLimit = (hole.Size.Magnitude / 2) * rocheLimitFactor  -- rocheLimitFactor adjusts the Roche limit size
  54.  
  55.     -- Check if the object is within the Roche limit
  56.     if distance <= rocheLimit then
  57.         -- Iterate through all descendants of the object
  58.         for _, descendant in pairs(object:GetDescendants()) do
  59.             -- Check if the descendant is a JointInstance and destroy it
  60.             if descendant:IsA("JointInstance") then
  61.                 descendant:Destroy()
  62.             end
  63.         end
  64.     end
  65. end
  66.  
  67. -- Prevent division by zero
  68. if sizeProportion == 0 then
  69.     sizeProportion = 10e-4
  70.    
  71.     if not logger.sizeProp then
  72.         print("{BHv5A} sizeProportion cannot be 0! (division by zero)")
  73.     end
  74. end
  75.  
  76. local function ApplyGravity(object)
  77.     -- Delay to pause calculations for better FPS
  78.     local currentTime = tick()
  79.     if currentTime - lastUpdateTime < updateInterval then return end
  80.     lastUpdateTime = currentTime
  81.  
  82.     -- Main bulk of gravitational forces
  83.     local direction = hole.Position - object.Position
  84.     local distance = direction.Magnitude
  85.     local holeRadius = hole.Size.Magnitude / 2 -- [NEW!] Make the radius of infinityHandler bigger or smaller (default, /2) something epic will happen ;)
  86.  
  87.     -- -------Don't touch, this formula has been tweaked for exact range of effectiveness!-------- --
  88.     local distanceSquared = (distance / ((rangeFactor / 100) + ((rangeFactor / 100) * (1 / 64)))) ^ 2
  89.     -- ------------------------------------------------------------------------------------------- --
  90.     local magnitude = gravitationalConstant / distanceSquared
  91.  
  92.     -- Adjust gravitational constant for velocity-based gravity
  93.     local engineType = string.lower(gravityEngine)
  94.     if engineType == "velocity" or engineType == "speed" or engineType == "2" and gravitySync then
  95.         magnitude = magnitude / (gravitationalConstant * 0.1) -- Dampening factor for velocity-based gravity
  96.     end
  97.  
  98.     local force = direction.Unit * magnitude * object:GetMass()
  99.  
  100.     -- [NEW!] --
  101.     -- Stops objects from speeding to infinity at the center of the hole
  102.     if infinityHandler then
  103.         if distance < holeRadius then
  104.             -- Force adjustment for both engines
  105.             force = Vector3.zero -- Removes gravity, acts like a vacuum (make into -force for something epic to happen)
  106.             direction = Vector3.zero -- Prevents direction inversion for velocity-based logic
  107.         end
  108.     end
  109.  
  110.     -- Apply the gravity engine logic based on selected type
  111.     if engineType == "bodyforce" or engineType == "force" or engineType == "1" then
  112.         local bodyForce = object:FindFirstChild("BlackHoleBodyForce")
  113.         if not bodyForce then
  114.             bodyForce = Instance.new("BodyForce")
  115.             bodyForce.Name = "BlackHoleBodyForce"
  116.             bodyForce.Force = Vector3.new(0, 0, 0)
  117.             bodyForce.Parent = object
  118.         end
  119.         -- Apply damping to the force to prevent instability
  120.         bodyForce.Force = (bodyForce.Force + force) * damping
  121.  
  122.         -- Print the gravity type only once
  123.         if not logger.bodyForce then
  124.             print("{BHv5A} Using FORCE-based gravity (+Stability, -Accuracy) MODEL SUPPORTED")
  125.             logger.bodyForce = true
  126.         end
  127.  
  128.     elseif engineType == "velocity" or engineType == "speed" or engineType == "2" then
  129.         -- Apply custom velocity-based gravity
  130.         local blackHoleRadius = hole.Size.X / 2
  131.  
  132.         -- Prevents objects from accelerating too fast or getting stuck at the black hole center
  133.         if distance < blackHoleRadius and infinityHandler then
  134.             -- Override velocity adjustments inside the radius
  135.             return
  136.         elseif distance < blackHoleRadius then
  137.             -- If infinityHandler is not enabled, ignore object adjustments inside the radius
  138.             return
  139.         end
  140.  
  141.         -- Apply the custom velocity-based gravity formula
  142.         object.Velocity = object.Velocity + force * damping
  143.  
  144.         -- Print the gravity type only once
  145.         if not logger.velocity then
  146.             print("{BHv5A} Using VELOCITY-based gravity (-Stability, +Accuracy) DOES NOT SUPPORT MODELS!!!")
  147.             logger.velocity = true
  148.         end
  149.        
  150.     elseif not logger.gravEngine then
  151.         -- Print an error for invalid gravity engine types
  152.         print("{BHv5A} Invalid Gravity Engine request! Switching to default (Force-based Gravity)")
  153.         logger.gravEngine = true
  154.         gravityEngine = "1"
  155.     end
  156. end
  157.  
  158. -- MAIN GRAVITATIONAL FORCE COMPUTER (Applies gravity to anything) --
  159.  
  160. local function CheckAndApplyGravity(obj)
  161.     -- Check if the object is a descendant of a BasePart (including all physical objects)
  162.     if not obj:IsDescendantOf(game.Workspace) or not obj:IsA("BasePart") then
  163.         return
  164.     end
  165.  
  166.     -- Exclude the black hole itself and players from gravitational pull
  167.     if obj == hole or obj.Parent:IsA("Player") then -- Remove obj.Parent:IsA("Player") if you like
  168.         return
  169.     end
  170.  
  171.     -- Exclude anchored objects to maximize performance
  172.     if obj.Anchored then
  173.         return
  174.     end
  175.    
  176.     -- Check for Roche limit and destroy joints if necessary
  177.     DestroyJointsWithinRocheLimit(obj)
  178.  
  179.     ApplyGravity(obj)
  180. end
  181.  
  182. game:GetService("RunService").Heartbeat:Connect(function()
  183.     for _, object in pairs(game.Workspace:GetDescendants()) do
  184.         CheckAndApplyGravity(object)
  185.     end
  186. end)
  187.  
  188. -- FUNCTION TO ABSORB SMALLER BLACK HOLES [BETA] --
  189.  
  190. local function AbsorbSmallerBlackHole(otherBlackHole)
  191.     -- Helper function to calculate the average size of a black hole
  192.     local function AverageSize(part)
  193.         return (part.Size.X + part.Size.Y + part.Size.Z) / 3
  194.     end
  195.  
  196.     -- Get sizes of both black holes and calculate the size difference
  197.     local thisSize = AverageSize(hole)
  198.     local otherSize = AverageSize(otherBlackHole)
  199.     local sizeDifference = math.floor((thisSize - otherSize) * 1000 + 0.5) / 1000
  200.  
  201.     local function resetForces(blackHole)
  202.         local bodyForce = blackHole:FindFirstChild("BlackHoleBodyForce")
  203.         if bodyForce then
  204.             bodyForce.Force = Vector3.new(0, 0, 0)
  205.         end
  206.     end
  207.  
  208.     local function applyNewForce(blackHole)
  209.         local newForce = blackHole.Size.Magnitude * 2
  210.         local newBodyForce = Instance.new("BodyForce")
  211.         newBodyForce.Force = Vector3.new(0, newForce, 0)
  212.         newBodyForce.Parent = blackHole
  213.     end
  214.  
  215.     if sizeDifference > 0.001 then
  216.         -- Larger black hole absorbs the smaller one
  217.         CollectionService:RemoveTag(otherBlackHole, "Blackholev5")
  218.         task.wait(0.01)
  219.  
  220.         resetForces(otherBlackHole)
  221.  
  222.         -- Increase size and range of the larger black hole
  223.         hole.Size = otherBlackHole.Size * 0.5
  224.         rangeFactor = (hole.Size.Magnitude * 0.5) * (rangeProportion / sizeProportion)
  225.  
  226.         otherBlackHole:Destroy()
  227.  
  228.         resetForces(hole)
  229.         applyNewForce(hole)
  230.  
  231.     elseif sizeDifference < -0.001 then
  232.         -- Smaller black hole is absorbed by the larger one
  233.         task.wait(0.1)
  234.         resetForces(otherBlackHole)
  235.         applyNewForce(otherBlackHole)
  236.         hole:Destroy()
  237.  
  238.     else
  239.         -- Both black holes merge into a new one
  240.         local unifiedSize = hole.Size * 2
  241.         local newBlackHole = hole:Clone()
  242.  
  243.         newBlackHole.Size = unifiedSize
  244.         newBlackHole.Position = hole.Position
  245.         newBlackHole.Parent = hole.Parent
  246.         CollectionService:AddTag(newBlackHole, "Blackholev5")
  247.  
  248.         -- Update Glint size to be twice as large
  249.         local newGlintSize = glint.Size.Keypoints[1].Value * 2
  250.         newBlackHole.VFX.Glint.Size = NumberSequence.new(newGlintSize)
  251.  
  252.         hole:Destroy()
  253.         otherBlackHole:Destroy()
  254.  
  255.         resetForces(newBlackHole)
  256.         applyNewForce(newBlackHole)
  257.  
  258.         hole = newBlackHole
  259.     end
  260. end
  261.  
  262. -- DAMAGE/KILLER (Kills players when they touch it) --
  263.  
  264. function onTouch(part)
  265.     local humanoid = part.Parent:FindFirstChild("Humanoid")
  266.     if humanoid then
  267.         humanoid.Health = 0
  268.     end
  269. end
  270.  
  271. if killPlayers then
  272.     hole.Touched:Connect(onTouch)
  273. end
  274.  
  275. -- Function to scale Glint's Size over time based on the black hole's size
  276. local function updateGlintSize()
  277.     local currentSize = hole.Size.X
  278.     if currentSize ~= previousSize then
  279.         -- Calculate the scale factor based on size change
  280.         local scaleFactor = currentSize / previousSize
  281.  
  282.         -- Update the size of Glint
  283.         local size = glint.Size
  284.         local newSize = size.Keypoints[1].Value * scaleFactor
  285.  
  286.         -- Set the new size to the particle emitter
  287.         glint.Size = NumberSequence.new(newSize)
  288.  
  289.         -- Update the previous size to the current size for future scaling
  290.         previousSize = currentSize
  291.     end
  292. end
  293.  
  294. -- DEMATERIALIZER (Deletes ANY object that touches it except for other black holes) --
  295.  
  296. function onTouched(part)
  297.     if CollectionService:HasTag(part, "Blackholev5") and mergeBlackholes then
  298.         AbsorbSmallerBlackHole(part) -- Absorb the smaller black hole if applicable
  299.         return
  300.     end
  301.  
  302.     if part.Anchored then
  303.         return -- Skip anchored objects
  304.     end
  305.  
  306.     if CollectionService:HasTag(part, "Blackholev5") and paradoxHandler then
  307.         return
  308.     end
  309.  
  310.     -- Calculate average size
  311.     local function CalculateAverageSize(part)
  312.         local size = part.Size
  313.         local averageSize = (size.X + size.Y + size.Z) / 3
  314.         return averageSize
  315.     end
  316.  
  317.     local objectAverageSize = CalculateAverageSize(part)
  318.     local blackHoleSize = hole.Size.X
  319.  
  320.     -- Calculate the new size increment based on the object's average size
  321.     local sizeIncrement = (objectAverageSize / (blackHoleSize * sizeProportion))
  322.  
  323.     part.BrickColor = partColor
  324.     part.Material = partMaterialTransform
  325.     part.CanCollide = collision
  326.     part.Anchored = fixedPosition
  327.  
  328.     for _, transparency in ipairs(transparencySteps) do
  329.         part.Transparency = transparency
  330.         wait(dematerializeDuration)
  331.     end
  332.  
  333.     part:Destroy() -- Delete part after completing transparencySteps
  334.  
  335.     if growth then
  336.         -- Adjust the black hole's size based on the new size increment
  337.         hole.Size = hole.Size + Vector3.new(sizeIncrement, sizeIncrement, sizeIncrement)
  338.         rangeFactor = rangeFactor + sizeIncrement * rangeProportion
  339.     end
  340. end
  341.  
  342. -- Update the Glint size when the size of the hole changes
  343. game:GetService("RunService").Heartbeat:Connect(updateGlintSize)
  344.  
  345. if absorption then
  346.     local connection = hole.Touched:Connect(onTouched)
  347.     print("{BHv5A} Absorption is ENABLED")
  348.     logger.consuming = true
  349. else
  350.     print("{BHv5A} Absorption is DISABLED")
  351.     logger.consuming = true
  352. end
  353.  
  354. if toggleMicroGravity and workspace.Gravity ~= 0 then
  355.     game.Workspace.Gravity = 0
  356.     print("{BHv5A} Gravity is DISABLED")
  357.     logger.zeroGrav = true
  358. else
  359.     print("{BHv5A} Gravity is ENABLED")
  360.     logger.zeroGrav = true
  361. end
  362.  
  363. --------
  364.  
  365. --[[
  366.  
  367. -- [Blackhole v5 Alpha Release Documentation/Manual] Jan. 22, 2025 --
  368.  
  369. The most complicated blackhole model in Roblox. a lot of controls that does something with each other, but uses simple maths.
  370. If you have complaints with the blackhole, please leave a comment on the model page. and please, dont go nerdy on me, I barely know general and special relativities.
  371.  
  372. ----------
  373. I PHYSICAL
  374.  
  375.     IMPORTANT: Note that the blackhole is a MeshPart, resize the blackhole by holding `alt` to preserve proportions!
  376.         If you want to use a regular sphere, copy and paste every child of the blackhole onto the new sphere.
  377.         Can also be a cube, or custom MeshParts, but gravitational attraction is still spherical.
  378.  
  379.     `toggleMicroGravity` (quickly disable gravity) can be turned off or on if you dont want to go into the game settings manually.
  380.  
  381.     Change blackhole properties like `EventHorizon` (pitch black effect), color, transparency, mass, custom physical properties and more to your liking.
  382. ----------
  383.  
  384. ----------
  385. II GRAVITY
  386.  
  387.     Blackhole v5 Prototype runs on BodyForce-based gravity. Blackhole v4.0+ runs on Velocity-based gravity, v4 Betas are hybrid-based (force or velocity).
  388.  
  389.     `gravitationalConstant` is the base strength of the blackhole's overall gravity, which are manipulated by `damping` (suppresses violent simulation between 0 & 1),
  390.     and `rangeFactor` (area in studs where objects are pulled in, anything outside that is not affected. gravity is amplified for bigger values).
  391.    
  392.     When switching between BodyForce and Velocity gravity, note that gravitational constant is fixed, but the two behave differently. velocity-based is violent!
  393.         BodyForce gravity: Stable, less accurate, customizable range. overall a mode to play around with!
  394.         Velocity gravity: Violent, accurate, unlimited range. overall a mode to simulate blackholes with! (tweaked to synchronize with BodyForce)
  395.        
  396.     Since there's so many knobs to turn, you can break the blackhole. break it, I dare you. I double dare you. just kidding, just dont break the laws of math!
  397. ----------
  398.  
  399. ----------------------------
  400. III ABSORPTION & PERFORMANCE
  401.  
  402.     Objects are absorbed if `absorption` is enabled, which will follow `transparencySteps` (fading effect between 1 & 0 invisibilities)
  403.     in a span of `dematerializeDuration` (time to progress each transparency step) while `partMaterialTransform` (material absorbed objects turn into) and
  404.     `partColor` (color absorbed objects turn into) lead the object into deletion, causing `growth` to make the blackhole bigger and stronger with
  405.     `sizeProportion` (how fast the blackhole grows, bigger means slower growth) and `rangeProportion` (how fast rangeFactor grows, bigger means faster growth).
  406.         `sizeProportion` CANNOT be 0 as it divides, only non-zeroes. Positive = grow, negative = shrink, asymptote to 0 = max size of 2048 studs.
  407.        
  408.         Sizing: maximum is 2048 xyz, minimum is 0.001. not recommended to have micro blackholes as it causes issues, as well as infinity for range-related variables.
  409.        
  410.         Gravity: negative `damping` == repel objects like negative `gravitationalConstant`. also not recommended setting values to large numbers.
  411.  
  412.     `killPlayers` (kills absorbed players) can be turned on or off when simulating with a player. Please disable when doing rapid blackhole merging!
  413.         An error will say {attempt to index nil with 'FindFirstChild'} because it cannot identify any humanoids fast enough.
  414.  
  415.     `fixedPosition` (anchor absorbed objects) can help with performance, along with `collision` (make objects pass through eachother while being absorbed), and
  416.     `updateInterval` (value in seconds to update gravitational forces. lower values are accurate but slower, higher values are inaccurate but faster).
  417.  
  418.     If `absorption` is disabled, everything above within ABSORPTION is excluded EXCEPT `killPlayers`.
  419. ----------------------------
  420.  
  421. ------------------
  422. IV BETA PARAMETERS
  423.    
  424.     `infinityHandler` prevents objects that crosses `EventHorizon` (AKA the blackhole's volume) from accelerating into infinity at singularity (the very center)
  425.    
  426.     `paradoxHandler` prevents two blackholes from absorbing eachother when they touch.
  427.    
  428.     `mergeBlackholes` merges blackholes: bigger blackhole absorbs the smaller, equal blackholes merge into a blackhole twice as big.
  429.         When two different sized blackholes touch eachother with this enabled, it will cause the winning blackhole to accelerate to infinity. [BUG FIXED]
  430.        
  431.     `gravityEngine` modes between BodyForce-based gravity and Velocity-based gravity. accepts "1" or "force" too, and accepts "2" or "speed" as well, respectively.
  432.         BodyForce-based gravity ensures stable simulations, but a lower accuracy than to Velocity-based gravity, which is more violent, laggy and accurate.
  433.        
  434.     `glint` is the reference to a cosmetic the blackhole has. when changing its name and or location, you must also change the path of the variable.
  435.    
  436.     `glintProportion` not to be confused with `glintProportions`, modified value of `glintProportions` multiplied by `glintProportion` to change `glint` proportions.
  437.    
  438.     `rocheLimitFactor` is the area around the blackhole (multiple of the radius) where any joint is destroyed for realistic simulation. this feature is from v4.0+
  439.         This can be disabled by setting it to zero!
  440.    
  441.     `gravitySync` synchronizes the gravitational prowess of velocity-based gravity with the force-based gravity without modifying `gravitationalConstant`.
  442.         When disabled, note that velocity-based gravity is significantly more powerfull than force-based gravity, and modification to the constant is needed.
  443. ------------------
  444.  
  445. ----------
  446. V ADVANCED
  447.  
  448.     If you know how to code, you can edit the script to your liking.
  449.  
  450.     Tips:
  451.     In `CheckAndApplyGravity(obj)`, you can change `if not obj:IsDescendantOf(game.Workspace) or not obj:IsA("BasePart") then return end` to exclude specific objects.
  452.  
  453.     Changing `if obj == hole or obj.Parent:IsA("Player") then return end` will cause glitches. however, you may change `obj.Parent:IsA("Player")` without issues.
  454.  
  455.     Tinkering with `ApplyGravity(object)` and `onTouched(part)` can throw simulation accuracy off, modify cautiously.
  456.    
  457.     [NEW!]
  458.     Overriding `infinityHander` code can make the blackhole have strange, but cool behavior. Be careful with your math!
  459.    
  460.     Examples of overriding the function:
  461.         local holeRadius = hole.Size.Magnitude * 2 -- Increase the area bigger than the blackhole (twice in size). can be any value.
  462.         ...
  463.         if distance < holeRadius then
  464.  
  465.             force = Vector3.zero -- Removes gravity, acts like a vacuum (make into -force for something epic to happen) [DEFAULT]
  466.             OR
  467.             force = -force -- Inverts gravity, creating a forcefield shell around the blackhole [NEW!]
  468.            
  469.             direction = Vector3.zero -- Prevents direction inversion for velocity-based logic [KEEP]
  470.         end
  471.        
  472.     `gravitySync` is not an exact synchronization, only an approximation. If you have a solution to make it exact, modify the following dunction in the main script:
  473.        
  474.         if engineType == "velocity" or engineType == "speed" or engineType == "2" and gravitySync then
  475.             magnitude = magnitude / (gravitationalConstant * 0.1) -- Dampening factor for velocity-based gravity
  476.         end
  477. ----------
  478.  
  479. -- [Blackhole v5 Alpha Release Update Log] 22/01/2025 --
  480.  
  481. [ Alpha v0.4 ]
  482.  
  483. MASSIVE UPDATES:
  484. + Synchronized gravity for both BodyForce and Velocity-based gravities (both still work differently in handling objects)
  485. + Detailed update log
  486.  
  487. SMALL UPDATES:
  488. + Updated Documentation
  489. + Error handling for invalid `gravityEngine` requests
  490. + Overridable `infinityHandler` for epic stuff to happen, more info in Section V of Documentation:
  491.     `infinityHander` code can make the blackhole have strange, but cool behavior. Be careful with your math!
  492.        
  493.         Examples of overriding the function:
  494.             local holeRadius = hole.Size.Magnitude * 2 -- Increase the area bigger than the blackhole (twice in size). can be any value.
  495.             ...
  496.             if distance < holeRadius then
  497.  
  498.                 force = Vector3.zero -- Removes gravity, acts like a vacuum (make into -force for something epic to happen) [DEFAULT]
  499.                 OR
  500.                 force = -force -- Inverts gravity, creating a forcefield shell around the blackhole [NEW!]
  501.                
  502.                 direction = Vector3.zero -- Prevents direction inversion for velocity-based logic [KEEP]
  503.             end
  504. + Added `gravitySync` to equalize the strength of force and velocity-based gravities. more in `Documentation`.
  505.  
  506. INCOMING UPDATES:
  507. = Model support for Velocity-based gravity
  508.  
  509. ]]
  510.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement