Creating a wormhole portal with Unity particle systems
About two thirds into my Unity game development course on Udemy I discovered, as always, that I already know everything about everything and completing the course would be a pointless exercise in self-discipline. So I started working on my concept for a simple mobile game I had in my mind for a while.
The simple space ship piloting game called for a vortex-like wormhole entry portal. I have had a lot of fun using the Unity particle system in the past. A week ago kind of past. It’s not a polished product, but could be a good jump off point for something that actually looks good.
Let’s start with a base. A quick google search and I found a simple “wormhole” transparent png image. It’s easier to ask for forgiveness than permission, so I’ll sort out the copyright issue after the officer puts my wrists in handcuffs.
I like to load up my blog posts with animated GIFs
After adding the bitmap to my scene, I am adding the first particle system. I am looking for something that travels in circular motion and gives the whole thing a bit of life.
In order to achieve this effect, use following basic properties:
Duration: 10
Start Lifetime: 7
Start Speed: 1
Start Size: 0.1
Rate over time: 20
I swear if you squint your eyes, the position, rotation and scaling values actually don’t look that bad.
We are not done with orbiting yet
Let’s add another ring of more dispersed particles.
The main difference to the first particle system is we need to add “Randomize Position” set to 0.1 and Linear X to -0.05 under Velocity over Lifetime.
Now we have space fluff spinning around our portal.
Let’s make it more interesting and add theoretical foundations to our functioning wormhole.
The multiverse of wormholes
No self respecting wormhole can exist without appropriate explanation provided by theoretical physics. Ours will use string theory. I trust my audience has enough good manners to know all the ins and outs of the string theory, so I shall not detail them here. Instead, let’s add some “strings”.
You should be able to achieve this mind blowing effect by taking our first particle ring and modifying the transform X value. In my case I changed it from 5 to .5. This creates stretched particles that go around in circles and give you that cosy multiverse buzz. Experiment with scaling and speed to get the right degree of probability.
Suck it up
Wormholes do what wormholes do. They vaccuum stuff up and spit it out the other side. No one will believe your wormhole can take them anywhere unless it demonstrates its ability to suck.
The key to sucking is changing your Shape Angle to 65, Radius to 2.77, Spherize Direction to 0.3 and Randomize Position to 0.15.
Don’t forget to update your Velocity over Lifetime Orbital X to 0.3.
End product
Here you go. I am totally writing this post to share my knowledge and not because I am trying to procrastinate from learning about mobile game publishing.