MoonWalk

January 5, 2022

Assignment:

  • Get up and running in Unity. Start by having a flat plane and a camera that allows you to move around. You will need to parent the main camera to a GameObject, and then add a script on that GameObject which will make the GameObject move and look around.
  • (normal) be able to move up, down, right, left and rotate around. Use Transform.Translate() for movement and Transform.RotateAround() for rotation.
  • (extra) add a camera control with the mouse, and use a CharacterController component for more realistic movement.

The Project

I stumbled into making something that felt like the moon and decided to go with it. In this world, you get to be the moon and you walk within this space, exploring stars. It was fun to explore some textures and lighting to start to see what aesthetics work well in Unity. I also enjoyed getting to play with and combine some code from a few different lessons. Getting the stars to randomly generate based off of a public variable was a nice little development win for me!

In addition to code provided by Pierre in class, I used code from this video: https://www.youtube.com/watch?v=3uOdm2wt43E and from this forum: https://answers.unity.com/questions/1743970/make-player-not-go-through-walls.html. To be honest, I don't fully understand the code enough to re-write, but I feel like I'm reading it ok and can manipulate it for what I need. I'd like to understand it better though. For assets, I used textures from Envato Elements.

Problems:

  1. I'm not sure how to set up the controls so that you can rotate around and walk and move up and down. Is there a standard for this?
  2. I couldn't figure out how to prevent the moon from going through the walls. As it is currently written, I am able to trigger when the when moon goes through the wall and print to the console, but I didn't figure out how to freeze the direction. I think I could do it with math if I reset the room coordinates to be a bit friendlier. But also, there's probably a better way?
  3. I'm still getting comfortable in C#. At one point, I wanted to print the name of the object the script was attached to and spent too long not figuring it out. I'm gonna dig for a Unity C# cheat sheet (or maybe start collecting for one!)

Process

No items found.