Singularity Effect
This is currently something that went further than intended. I just wanted to make a black hole to look at. It has evolved into this thus far.
***NEW FEATURE*** 3/10/2025
- Perss/hold the J Key to Charge the Jump Drive. On release you will jump to an new skybox and a random new place likely further from the black hole.
- Use the sliders, buttons, mouse wheel, and toggles to control the gravity and speed of the singularity.
- Fly into the core of the singularity and it will play a special effect, teleport you in a random direction up to 9000 units from the singularity.
- Press the Spacebar to initiate warp speed drive to get back to the singularity faster.
- Manually change the skyboxes at will with V or a button I made.
- Dynamic Gravity Experience: In this game, you'll encounter a unique feature called the "Singularity." It's a powerful, invisible force that acts like a gravitational black hole in the game's environment. Imagine a spot where objects are irresistibly pulled towards it – that's the Singularity.
- Interactive Control: You can control the strength of this Singularity. Using your mouse wheel, you can adjust how strong or weak this gravitational pull is. This means you can make the Singularity either gently tug at objects or powerfully yank them towards its center.
- Visual Feedback: As you adjust the Singularity's power, you'll see a UI slider on your screen that visually represents the current strength of the gravitational pull. This slider moves in real-time as you use your mouse wheel, giving you immediate feedback on your adjustments.
- Percentage Display: Accompanying the slider, there's also a percentage display. This display shows you exactly how powerful the Singularity is as a percentage of its maximum force. It updates in real-time, so you always know the intensity of the gravitational pull you're exerting.
- Engaging Gameplay Mechanic: While playing, you'll see objects in the game environment react to the Singularity. Objects that can be influenced by it will start moving towards the Singularity based on the gravity strength you set. It creates a dynamic environment where you can experiment with the gravitational force and see its effects on the objects.
3/30/25
Singularity Effect Updates 3/30/2025
1. Initial Change: Return to Original Position
- Goal: Make non-player objects return to their original positions instead of disappearing forever.
- Changes:
- Added a Dictionary<GameObject, Vector3> originalPositions to store initial positions.
- Recorded positions in OnTriggerStay when objects first enter.
- Replaced permanent deactivation (SetActive(false)) with a coroutine (ResetObject) that reactivates objects at their original positions after a resetDelay of 3 seconds.
- Reset physics (velocity and angular velocity) for returning objects.
2. Refinement: Starting Position and Longer Delay
- Goal: Ensure objects return to their starting positions (from game start) and take longer to return.
- Changes:
- Moved position recording to Start(), using FindObjectsOfType<SingularityPullable>() to capture all initial positions at game launch.
- Increased resetDelay from 3f to 10f for a longer wait before reappearing.
- Only reset objects if their position was pre-recorded, with a warning for untracked objects.
3. New Behavior: Eject with Force
- Goal: Instead of resetting to original positions, spit objects back out with force and extend the delay further.
- Changes:
- Replaced ResetObject with EjectObject, which reactivates objects near the black hole (at ejectionRadius, default 2f) and applies an outward force (ejectionForce, default 500f) in a random direction.
- Increased resetDelay from 10f to 15f for a longer wait before ejection.
- Added ejectionForce and ejectionRadius as public variables for tuning in the Inspector.
- Kept originalPositions as optional (no longer used for reset but retained for potential future use).
4. Final Addition: Text Indicator
- Goal: Display a count of objects currently “inside” the core.
- Changes:
- Added [SerializeField] private Text objectsInCoreText to link a UI Text component in the Inspector.
- Introduced private int objectsInCore = 0 to track the number of deactivated objects.
- Incremented objectsInCore in OnTriggerStay when an object enters and decremented it in EjectObject when ejected.
- Added UpdateObjectsInCoreText() to update the text (e.g., “Objects in Core: 2”), called in Start and after count changes.
- Requires a UI Text object in the scene, assigned in the Inspector.
Final Behavior:
- Non-Player Objects: When sucked into the black hole, they deactivate for 15 seconds (resetDelay), then reappear 2 units (ejectionRadius) from the core and are shot outward with 500 units of force (ejectionForce). The objectsInCore counter tracks how many are inside, displayed via a UI text (e.g., “Objects in Core: [number]”).
- Player: Still teleports randomly and gets immobilized for 5 seconds, unchanged.
- Setup: Requires a UI Text object assigned to objectsInCoreText in the Unity Inspector.
- Holding down the J button will charge a jump drive that can move you forward instantly a far distance
These changes evolved the black hole from a permanent sink to a dynamic system that ejects objects with force after a delay, complete with a live counter.
Updated | 1 day ago |
Status | In development |
Platforms | HTML5 |
Author | MauroDot |
Genre | Simulation |
Made with | Unity |
Comments
Log in with itch.io to leave a comment.
Superballs in space. This is a fun screensaver: Set “ship pull” to true and gravity to 0.5% and watch as the planets bounce around you and off each-other.
Yeah basically lol. I always wanted to try to make a black hole for whatever reason and so this is my first attempt. If the ship touches the core collider it will also teleport the ship randomly at least 2,000 units. I'm going to increase the units. Or maybe make it teleport into another scene where the solar system actually is with like a Milky Way background which I actually have the assets for... I've gotten all kinds of different reactions from the big balls. Increasing the speed instantly from the toggle differently has an effect and then incrementally increasing is definitely a bit different. If you release the ship at a high gravity pool it likely gets thrown out of bounds and extremely shaky and no way to get back...