Advertisement
1m1m0

BH v5 Alpha Documentation

Mar 1st, 2025
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.61 KB | None | 0 0
  1. --[[
  2.  
  3. -- [Blackhole v5 Alpha Release Documentation/Manual] Mar. 1, 2025 --
  4.  
  5. The most complicated blackhole model in Roblox. a lot of controls that does something with each other, but uses simple maths.
  6. 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.
  7.  
  8. ----------
  9. I PHYSICAL
  10.  
  11.     IMPORTANT: Note that the blackhole is a MeshPart, resize the blackhole by holding `alt` to preserve proportions!
  12.         If you want to use a regular sphere, copy and paste every child of the blackhole onto the new sphere.
  13.         Can also be a cube, or custom MeshParts, but gravitational attraction is still spherical.
  14.  
  15.     `toggleMicroGravity` (quickly disable gravity) can be turned off or on if you dont want to go into the game settings manually.
  16.  
  17.     Change blackhole properties like `EventHorizon` (pitch black effect), color, transparency, mass, custom physical properties and more to your liking.
  18. ----------
  19.  
  20. ----------
  21. II GRAVITY
  22.  
  23.     Blackhole v5 Prototype runs on BodyForce-based gravity. Blackhole v4.0+ runs on Velocity-based gravity, v4 Betas are hybrid-based (force or velocity).
  24.  
  25.     `gravitationalConstant` is the base strength of the blackhole's overall gravity, which are manipulated by `damping` (suppresses violent simulation between 0 & 1),
  26.     and `rangeFactor` (area in studs where objects are pulled in, anything outside that is not affected. gravity is amplified for bigger values).
  27.    
  28.     When switching between BodyForce and Velocity gravity, note that gravitational constant is fixed, but the two behave differently. velocity-based is violent!
  29.         BodyForce gravity: Stable, less accurate, customizable range. overall a mode to play around with!
  30.         Velocity gravity: Violent, accurate, unlimited range. overall a mode to simulate blackholes with! (tweaked to synchronize with BodyForce)
  31.        
  32.     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!
  33. ----------
  34.  
  35. ----------------------------
  36. III ABSORPTION & PERFORMANCE
  37.  
  38.     Objects are absorbed if `absorption` is enabled, which will follow `transparencySteps` (fading effect between 1 & 0 invisibilities)
  39.     in a span of `dematerializeDuration` (time to progress each transparency step) while `partMaterialTransform` (material absorbed objects turn into) and
  40.     `partColor` (color absorbed objects turn into) lead the object into deletion, causing `growth` to make the blackhole bigger and stronger with
  41.     `sizeProportion` (how fast the blackhole grows, bigger means slower growth) and `rangeProportion` (how fast rangeFactor grows, bigger means faster growth).
  42.         `sizeProportion` CANNOT be 0 as it divides, only non-zeroes. Positive = grow, negative = shrink, asymptote to 0 = max size of 2048 studs.
  43.        
  44.         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.
  45.        
  46.         Gravity: negative `damping` == repel objects like negative `gravitationalConstant`. also not recommended setting values to large numbers.
  47.  
  48.     `killPlayers` (kills absorbed players) can be turned on or off when simulating with a player. Please disable when doing rapid blackhole merging!
  49.         An error will say {attempt to index nil with 'FindFirstChild'} because it cannot identify any humanoids fast enough.
  50.  
  51.     `fixedPosition` (anchor absorbed objects) can help with performance, along with `collision` (make objects pass through eachother while being absorbed), and
  52.     `updateInterval` (value in seconds to update gravitational forces. lower values are accurate but slower, higher values are inaccurate but faster).
  53.  
  54.     If `absorption` is disabled, everything above within ABSORPTION is excluded EXCEPT `killPlayers`.
  55. ----------------------------
  56.  
  57. ------------------
  58. IV BETA PARAMETERS
  59.    
  60.     `infinityHandler` prevents objects that crosses `EventHorizon` (AKA the blackhole's volume) from accelerating into infinity at singularity (the very center)
  61.    
  62.     `paradoxHandler` prevents two blackholes from absorbing eachother when they touch.
  63.    
  64.     `mergeBlackholes` merges blackholes: bigger blackhole absorbs the smaller, equal blackholes merge into a blackhole twice as big.
  65.         When two different sized blackholes touch eachother with this enabled, it will cause the winning blackhole to accelerate to infinity. [BUG FIXED]
  66.        
  67.     `gravityEngine` modes between BodyForce-based gravity and Velocity-based gravity. accepts "1" or "force" too, and accepts "2" or "speed" as well, respectively.
  68.         BodyForce-based gravity ensures stable simulations, but a lower accuracy than to Velocity-based gravity, which is more violent, laggy and accurate.
  69.        
  70.     `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.
  71.    
  72.     `glintProportion` not to be confused with `glintProportions`, modified value of `glintProportions` multiplied by `glintProportion` to change `glint` proportions.
  73.    
  74.     `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+
  75.         This can be disabled by setting it to zero!
  76.    
  77.     `gravitySync` synchronizes the gravitational prowess of velocity-based gravity with the force-based gravity without modifying `gravitationalConstant`.
  78.         When disabled, note that velocity-based gravity is significantly more powerfull than force-based gravity, and modification to the constant is needed.
  79. ------------------
  80.  
  81. ---------------
  82. V EXPERIMENTALS
  83.    
  84.     Automatically disables other BH scripts to prevent conflicts.
  85.     For `Constraint-based gravity`: `gravitationalStrength` = `gravitationalConstant`, `absorption`, `toggleMicroGravity`, `constraintMode` = `gravityEngine`, and
  86.     `detectionRange` = `rangeFactor` are the same as their main script counterparts EXCEPT:
  87.        
  88.         `dampingFactor` is the elasticity of constraints, 0 means no bouncy and 1 is bouncy. `damping` is reversed in logic.
  89.         `innerEventHorizon` is similar to `infinityHandler` but the range is in studs in which constraints stop applying forces. more on `infinityHandler` next section.
  90.         `visibleConstraints` simply allows you to see active constraints on objects for testing. this does not affect performance.
  91.         `centerOfMassBased` sets if forces are applied at the center of MASS. force attachments are placed at the center of GEOMETRY.
  92.         `forceCap` sets the maximum force for objects when using linear and realistic LineForce. this prevents infinite speed at singularity.
  93.         -- ADVANCED --
  94.         `gravitationMode` toggles between universal and selective gravitation for specifc objects. requires tags in desired objects with the same value as `attractionTag`
  95.         `attractionTag` is the specific id for the blackhole to pick out and apply gravity while leaving anything without the tag alone.
  96.        
  97.         Constraint modes:
  98.         `spring` or `1` - pretty self-explanatory, uses elasticity to reel in objects, causing them to get jiggy with it.
  99.         `rope` or `2` - just like spring, but with less jiggy, but both can have their jiggy-ness controlled with `dampingFactor`.
  100.         `line` or `3` - a "constraint", but a force like BodyForce. this version may replace bodyforce-based gravity entirely, but I'll still keep the legacy mode.
  101.         `vector` or `4` - similar to lineforces, but uses xyz distribution to apply gravity. generally how bodyforce-based gravity works.
  102.         `linear1` or `5.1` - line-based linear velocity. the old velocity-based gravity and mat replace it, but it can also be accessed. THIS HAS MODEL SUPPORT! RAAAAAH
  103.         `linear2` or `5.2` - vector-based linear velocity. does not support orbits and boring in my opinion.
  104.    
  105.     Experimentals doesn't have much freedom for parameters, only when they're fully integrated into the main scripts. a complete revamp of `gravityEngine` is underway!
  106. ---------------
  107.  
  108. -----------
  109. VI ADVANCED
  110.  
  111.     If you know how to code, you can edit the script to your liking.
  112.  
  113.     Tips:
  114.     In `CheckAndApplyGravity(obj)`, you can change `if not obj:IsDescendantOf(game.Workspace) or not obj:IsA("BasePart") then return end` to exclude specific objects.
  115.  
  116.     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.
  117.  
  118.     Tinkering with `ApplyGravity(object)` and `onTouched(part)` can throw simulation accuracy off, modify cautiously.
  119.    
  120.     Overriding `infinityHander` code can make the blackhole have strange, but cool behavior. Be careful with your math!
  121.    
  122.     Examples of overriding the function:
  123.         local holeRadius = hole.Size.Magnitude * 2 -- Increase the area bigger than the blackhole (twice in size). can be any value.
  124.         ...
  125.         if distance < holeRadius then
  126.  
  127.             force = Vector3.zero -- Removes gravity, acts like a vacuum (make into -force for something epic to happen) [DEFAULT]
  128.             OR
  129.             force = -force -- Inverts gravity, creating a forcefield shell around the blackhole [NEW!]
  130.            
  131.             direction = Vector3.zero -- Prevents direction inversion for velocity-based logic [KEEP]
  132.         end
  133.        
  134.     `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:
  135.        
  136.         if engineType == "velocity" or engineType == "speed" or engineType == "2" and gravitySync then
  137.             magnitude = magnitude / (gravitationalConstant * 0.1) -- Dampening factor for velocity-based gravity
  138.         end
  139.        
  140.     `gravitationMode` and `attractionTag` are relatively easy to use if you know how tags work. why did I make it advanced? I wanted to make cool demoes.
  141.        
  142. -----------
  143.  
  144. You may be wondering, how much did I put into this?
  145. Yes.
  146.  
  147. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement