I'm working on a starfield right now. How do you always make the stars come towards you while moving the ship through 3D space at any angle?
Just using the stars as an effect and not really part of the world does not look right when you turn the ship. The stars should react somewhat to your moves.
Could I treat the stars like a 3D cube? After all I have a finite amount of stars within a section of 3D space. Then perhaps I could use backface culling to find out which side faces me, get the surface normal of it, and move the stars along that normal. Will that work? It's much faster than calculating the actual normal from the star to my ship for every star.
Also, how do I make these stars loop in 3D space. Since it is a finite cube of stars, it is possible to fly out of the starfield and into nothingness. Again do I take the normal of the face that my ship is heading and then reset the stars along that normal a set distance to "push" them into the distance along my normal vector?
For instance:
my ship --->
the normal of my ship's vector is the plane that my ship is in. Draw a box around the front of my ship's nose, like a big shield on the front or something. If i take the surface normal of that box, I will get my direction vector.
Please, I need help. I've looked at the web and found only simple starfields with no motion relative to an actual 3D universe.