I’m still on night shifts on the run up to Christmas so putting these concepts into action will come later.
SUMMARY:
How can I create a decent transit for Hyperspace?
What am I working on?
So it’s a Space game. Right.
Players will have their own ships, capable of entering Hyperspace. However, I need some help on HOW to stylize this?
Currently, my method works by the Exterior of the Starship rotating to the desired direction. Once done, a Module is then called that will do the effects.
Following this, the BodyPosition of the Starship will be Tweened to the desired location. This allows me to easily set the speed of transit.
Why is this a problem?
As the Starship shares the same Space as clients, when going from Point A to Point B - If any Planets or Stations are in the line of path, the ship goes straight through them and this can ruin immersion.
Now I have conceptualised another method - The Starship will enter Hyperspace and then be moved to a Random Vector, still showing the effects. However, instead of Tweening the position - I’ll use a :Wait() so after a certain amount of time has passed, the ship will appear anywhere in a circle radius around and facing the desired location.
Now this is an issue as Players will see the ship turn to face the direction and then completely vanish. Whereas with my first method, the ship was seen racing across the map at high speeds.
Could you figure out (math, Raycasting, other methods?) if there is something along the path and if so create a 2 direction path that causes the ship to ‘steer’ halfway through it’s journey so it’ll go around any items in the way?
I did a search for max raycast distance and a post mentioned that the max distance is 5000 studs.
If you raycast forward and find something 5000 studs ahead couldn’t you just angle the ship slightly for a moment, then realign it to the target?
If you need range greater than 5000 studs then maybe have a transparent, cancollide off Part welded 5000+ studs ahead of the first raycast with a second ray in the Part facing ‘forward’ to detect anything from 5000-10000 studs ahead.
Personally, my solution to this would be to raycast and find any planets in the way and throw them into a folder in ReplicatedStorage for the duration of the hyperspace warp. You could hide the planets popping in and out with the hyperspace animation itself. Perhaps the screen briefly flashes to white when entering and exiting hyperspace? The reparenting of the obstructing planets could be done during that animation.
Sure it isn’t ideal, but off the top of my head it seems to be the easiest way of going about this without spending too much time on it.
Of course, this is all under the assumption that you’re dead-set on having players see the planets as they go by.
You can use body gyro to steer the space craft and just tilt it to the side. Or you can make a warping effect so it would look like the spaceship could go through stuff with enough speed.
Strange way to do it but couldn’t you just put a screen gui over the entire screen with a hyperdrive animation ? (Like in pulsar lost colony (except it’s not a gui but same concept))
Chain the raycasts together. Keep shooting more rays, starting from where the previous one ended, until you’ve gone the entire length of the hyperspace warp. This will also make sure that you find all planets along the warp path, not just the first one.
Nice theory!
How would be best to generate the Raycast? During motion or pre motion?
Sort of thinking of having it pre motion, so once turning is complete it quickly runs the Ray, say about 5 times, picking up from either where it ends or where it detected an obstruction then adding these Instances into a table that is passed into the Hyperspace Module and edited accordingly during motion // arrival?
I noticed that if you were to create Perlin worms but only render like every 5th cell and move the offset of them (change input) it gives this no man’s sky like effect