Advertisement
1m1m0

BHv5 Rescripted Documentation

Mar 16th, 2025
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.31 KB | None | 0 0
  1. --[[
  2.  
  3. -- [Blackhole v5 Alpha Release Documentation/Manual RESCRIPTED] Mar 16, 2025 --
  4.  
  5. [UPDATE!] Complete revamp of the entire code. Though this isnt a full full release, just a demo. This model no longer uses the old template of v5 and v4 lite
  6. The most complicated blackhole model in Roblox. a lot of controls that does something with each other, but uses simple maths.
  7. 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.
  8.  
  9. Self-explanatory components are not included cuz i expect you to know how they work
  10.  
  11. ----------------
  12. -- I PHYSICAL --
  13. ----------------
  14.  
  15.     IMPORTANT: Note that the blackhole is a MeshPart, resize the blackhole by holding `alt` to preserve proportions!
  16.         If you want to use a regular sphere, copy and paste every child of the blackhole onto the new sphere.
  17.         Can also be a cube, or custom MeshParts, but gravitational attraction is still spherical.
  18.  
  19.     `toggleMicroGravity` (quickly disable gravity) can be turned off or on if you dont want to go into the game settings manually.
  20.  
  21.     Change blackhole properties like `EventHorizon` (pitch black effect), color, transparency, mass, custom physical properties and more to your liking.
  22.  
  23. ----------------
  24. -- II GRAVITY --
  25. ----------------
  26.  
  27.     Blackhole v5 Alpha runs on various constraint gravities: LinearVelocity, LineForce, VectorForce, & AlignPosition.
  28.     The old BodyVelocity and BodyForce-based gravities are preserved as legacy, but in my descretion, you may still use them.
  29.  
  30.     `gravity` is the base strength of the blackhole's overall gravity. setting it to negatives will push objects away.
  31.         Gravity can be chosen using "1.1", "1.2", "2", "3", & "4" but you can also choose "linear1", "linear2", "line", "vector", & "align" with `gravityEngine`.
  32.         Legacy gravities can be chosen with "5", "6" or "force", "speed", or "bodyforce", "bodyvelocity".
  33.         `gravitationMode` can be chosen between "universal" to attract every object and "selective" to only attract objects with the `attractionTag` ("attractable").
  34.         Setting `gravity` to a negative value will trigger something cool, trust
  35.        
  36.     `alignSpeed` is an alternate to gravity when using AlignPosition. higher number means faster speeds.
  37.     `range` is the area in studs where objects are pulled in, anything outside that is not affected. default is 500 studs.
  38.     `forceCap` sets the maximum force/velocities on objects while moving within range, higher caps mean laggier simulations. default is 2000.
  39.     `centerOfMassBased` applies constraint gravities at the center of masses of objects. it already does this, but this is for when the mass DOES change.
  40.     `realisticGravity` uses inverse square law. basically the closer objects are, the stronger the gravity. its recommended you use BodyVelocity!
  41.     `realGravDamping` dampens gravity when `realisticGravity` is enabled. higher values means faster gravity, lower means slower (cannot be 0)
  42.     `microGravity` directly disables workspace gravity for better simulations. though you can do this via settings.
  43.    
  44.     If you want more freedom with the gravity, you can use BodyVelocity or BodyForce as its purely mathematical. break it if you want. i dare you, i double dare you.
  45.  
  46. ----------------------------------
  47. -- III ABSORPTION & PERFORMANCE --
  48. ----------------------------------
  49.  
  50.     Objects are absorbed only when `absorption` is enabled, else everything within Absoription does not apply:
  51.    
  52.     `growth` allows the blackhole to grow by absorbing objects, including other blackholes (v5+ only) while `growthDamping` sets the speed the blackhole can grow at.
  53.         `merging` allows blackholes to combine into bigger blackholes. though this may not work every time, so keep in mind that there will be bugs.
  54.         You can also set `growthDamping` to a negative to shrink the blackhole.
  55.    
  56.     `fading` allows objects to slowly fade out of existence, where `fadeDuration` will set how long objects will take to full fade out. fading also synergizes with
  57.     `colorShift` where the objects will shift to a color picked with RGB `color` and objects will shift to that color as its fading within `fadingDuration`.
  58.     `rocheFactor` is the range (in multiples of the blackhole's size) where objects' joints are removed including: Welds, Motors, Hinges, Ropes, and Springs.
  59.         This does not affect constraint gravities.
  60.        
  61.     Things to note: setting `fadeDuration` too high will cause performance issues, as well as larger `rocheFactors` if you have any models with joints nearby.
  62.     Also note that having too many blackholes will start to cause lag as they're calculating tons of calculations even for one.
  63.    
  64. ------------------------
  65. -- IV SPECIAL EFFECTS --
  66. ------------------------
  67.    
  68.     Special effects set the blackhole's appearance when running the simulation ONLY.
  69.    
  70.     `lensing` allows "gravitational lensing" to occur, bending light around the blackhole with a radius `lensingFactor` multiplies to the blackhole's size.
  71.         `lensingStrength` will set the intensity of the gravitational lensing; lower for less warping. do not set it too high or it will break the effect!
  72.         The value of `lensingFactor` becomes insignificant below 15, so it automatically sets it to 1 because it also means the least warping, which is none.
  73.        
  74.     `cameraDistortion` allows the FOV (only for editor/server mode) to be warped within range - closer means higher FOVs, furthest is default FOV.
  75.     `distortThreshold` sets the minimum range for FOV to reach the maximum (120) in percentages. default is 1 for 1% the blackhole's size
  76.     `blackHoleSound` toggles the blackhole's sound using the rainbow periastron blackhole sound. this sound is only heard within range.
  77.     `distortSound` is a feature that changes the pitch whenever its around other v5+ blackholes. this feature is still beta.
  78.     `glintSizeMultiplier` is the factor of propotionality for the `Glint` ParticleEmitter within `FX`. if you want to change it, go ahead. but it will unsync its size.
  79.  
  80. ----------------------------------------
  81. -- V EXPERIMENTALS | AKA THE TEMPLATE --
  82. ----------------------------------------
  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.         `cameraDistortion` is a toggleable parameter that allows the camera to warp for realism (Warning! May be nausea-inducing. This only works with Run)
  94.         `distortThreshold` is the factor (x100 for percentage) of `detectionRange` where the maximum FOV is achieved (min: 70 [default], max: 120 [absolute])
  95.         `alignSpeed` adjusts how fast objects will act to align or race toward the blackhole; small for smooth, high for fast.
  96.         `blackHoleSound` toggles the ambient sound the blackhole will make with a range exact to `detectionRange` to indicate whether you are in the range or not.
  97.         `gravitationMode` toggles between universal and selective gravitation for specifc objects. requires tags in desired objects with the same value as `attractionTag`
  98.         `attractionTag` is the specific id for the blackhole to pick out and apply gravity while leaving anything without the tag alone.
  99.        
  100.         Constraint modes:
  101.         `spring` or `1` - pretty self-explanatory, uses elasticity to reel in objects, causing them to get jiggy with it.
  102.         `rope` or `2` - just like spring, but with less jiggy, but both can have their jiggy-ness controlled with `dampingFactor`.
  103.         `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.
  104.         `vector` or `4` - similar to lineforces, but uses xyz distribution to apply gravity. generally how bodyforce-based gravity works.
  105.         `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
  106.         `linear2` or `5.2` - vector-based linear velocity. does not support orbits and boring in my opinion.
  107.         `align` or `6` - simple & efficient homing-based constraint that does not simulate orbits, rather useful for clusters of objects.
  108.    
  109.     Experimentals will continue to be a part of the blackhole for newer features before firectly integrating them into the main script
  110.  
  111. -----------------
  112. -- VI ADVANCED --
  113. -----------------
  114.  
  115.     If you know how to code, you can edit the script to your liking.
  116.    
  117.     You can modify the master formula: (gravity * blackHole:GetMass() * object:GetMass()) / ((effDist / realGravDamping) ^ 2)
  118.         Context, this is the Newtonian formula for gravity, tweaked to match robloxian environments. original formula is G(m1)(m2)/r^2
  119.         Also works with [something].Size.X or, an average of Size.XYZ dimensions
  120.        
  121.     This is just here in case i need it or found a fix
  122.     -- Disable other gravitational scripts to avoid conflicts
  123.     local scriptConflict = false
  124.     if script.Enabled then
  125.         if not blackHole["Constraint-based_grav"] then blackHole["Constraint-based_grav"].Enabled = false scriptConflict = true end
  126.         if not script.v5A_Deprecated then script.v5A_Deprecated.Enabled = false scriptConflict = true end
  127.     end
  128.    
  129.     `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.
  130.    
  131.     Modifying the minimum FOV:
  132.         ...
  133.         if distance >= detectionRange then
  134.             newFOV = 70 -- Default FOV, but feel free to change it
  135.         elseif distance <= detectionRange * distortThreshold then
  136.             newFOV = 120 -- Maximum FOV, roblox does not allow higher
  137.         else
  138.             local t = (detectionRange - distance) / (detectionRange - distortThreshold)
  139.             newFOV = 70 + t * (120 - 70)
  140.         end
  141.  
  142. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement