Fun with Unity - Making spaceships move
I have my project broken into milestones, which I call phases... and the first phase is nearing completion. The first phase is simply to be able to render a space station of appropriate scale, and then be able to "fly" around it.
This involved a few things:
1) finding a good space station model and then rendering it (done)
2) creating a camera
3) mapping my XBox controller's DPAD to the game (by default, the xbox dpad is not part of the project, it follows the 6th and 7th axis from the input object so I had to go into the input manager and add this)
4) create a new ship class which would be tied to the camera which would have the code required for making it move
As of right now the ship will turn on its x and y axis (i will add rotating on the z later as currently that's not vital). Still to do is add acceleration and max speed.
I have a few variables in line to hold this information... a maxSpeed which will represent meters/second and a throttle which will allow the player to incrementally raise the speed up by 10% each time to a max of 100. This was mapped to the DPAD up and down.
Working with acceleration. Spacecraft shouldn't just start moving at X meters per second, it needs to build up.
Stabalizer code. Pure space means with no friction that once moving in a direction you will continue to move in that direction indefinitely. I have added stabalizer settings which a ship will have to counteract zero-gravity. However... perfect stabalizer should not exist. If I rotate right on the X axis I should slowly continue to rotate on the X axis when I release my joystick for a short time while the stabalizers kick in to stop the motion.
Once this is complete I will add rotation of the Z axis and my phase one will be complete: a moving camera in first person mode flying around a space station set on a black backdrop of nothing.
I also added some point lighting to the station to light up some of the features from interior lights. I discovered a thing called lightmapping last night but I'm not sure if its relevant at this point as there is no real scenery in space... at least not at the moment. It appears that UNITY doesn't light map objects... when I put my station's objects STATIC and tried to lightmap the mesh it told me there was nothing to lightmap.
I could also be doing it wrong. Which is a likely possibility.