- Home /
Difficulties with "Moving the Space, Not the Player"
OK, I've familiar with the whole Futurama/StarTrek11 concept of moving the Universe around a stationary player. I get it.
I've even been able to achieve this effect using a hacked copy of the Space Flight Sim script.
The problem I am having is a difficult one to get past. Consider this scenario:
I've created an asteroid field, full of rocks. I want to fly around in this rocks.
I've been able to make the player stay at 0,0,0, but make the asteroid field slowly move towards the player. Its just as visually-convincing as actually moving the player through stationary rocks.
The PROBLEM is when i've passed through the asteroids, and I am now on the other side of the field. If I try to turn around and go back, its impossible. I am, after all, stationary. My controls now do the opposite based on my spatial position, and the asteroids continue to move far away, growing ever more out of reach.
Now, I've read a few threads where this scenario is discussed (in one permutation or another) - unfortunately I didn't find any tricks that I could derive into a solution.
I believe what I want to do is very simple for someone who truly understands 3-Dimensional math. I do not understand 3-Dimensional math, but nonetheless I AM making progress with my work. I feel like this one piece could open up a lot of other possibilities for other 'scenes'.
I would appreciate any assistance, perhaps from someone who's done an innovative space game or something similar.
Thank you
Here's one example where someone else encountered my problem. See the very last post at the bottom, author: ForceX
http://forum.unity3d.com/threads/52667-Solved-$$anonymous$$esh-shakes-after-moving-1000-units
Note also no one responded =(
If it looks the same as moving the player, why aren't you just moving the player? It's simpler, easier, requires less code, and requires fewer computations giving a higher frame rate.
It doesn't matter what you are moving as long as the player can't tell the difference.
$$anonymous$$y understanding this was a good idea for massive-area space games. I guess I am just having issues trying to devise a way of staging a good sized solar system so that one celestial object (or group of objects) is in a given scene at any one time. Examples of such objects would be asteroid fields, a planet, a moon, or a sun.
Since they obviously are not all in the same region (nowhere close to each other in reality), it seems good to have space that moves around a stationary player. Distant objects would be smaller scale models that, when approached, would dispose of the current scene, and launch the new, close-up object. At least, this "seemed" like a good approach after all the reading I had done.
Have a better idea? I'm open to anything at this point.
Thanks
I also have the idea for a massive-area space game in my head. I haven't started it yet, so I'll just memory dump the technical detail ideas I had in my head:
For each system, have a single empty GameObject. Parent EVERYTHING inside the system to that GameObject, including the player when they enter. This way the local coordinates will always have the center of that system be (0,0,0). Repeat on smaller scale for asteroid fields and the like.
$$anonymous$$ove ONLY the player. Fewer scripts and movement calculations required. If it's stationary, IT IS STATIONARY. $$anonymous$$oving the world around will require calculations for EVERY object in the world as compared to just a small handful. Also, moving the world ins$$anonymous$$d of the player makes multi-player support impossible.
Every 5-10ish seconds on a coroutine (prevents excessive checking), if distance from player to center of system > system size: unparent player; unload the entire system; load the next system;
Parenting is your friend. You are going to be moving parents around A LOT in any sort of large-scale space game. If you have a problem, try moving around and adding parents with empty GameObjects and that usually helps a lot.
NEVER reinvent the wheel. Look to past games for inspiration. The more obscure the game, the better.
Less is more.
Excellent, thank you. Some of these considerations have been made, most notably your first item (parenting entire scenes inside of empty game objects).
How does one parent/unparent via scripts? I've never done that.
Your answer
Follow this Question
Related Questions
Mouselook in space, without a 'down' or 'up' 1 Answer
How to Create Shields 2 Answers
Increase the size of a Scene (space map) 1 Answer
Freelancer of Freespace type Enemy Ai 2 Answers