Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Fun with Unity - Making spaceships move

Sign in to follow this  


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.

Challenges ahead:
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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!