Unity Tutorial 02 (Semester 2)

 


Image from the tutorial

For this weeks Unity tutorial I had to continue on from last weeks one where we set up Ruby's Adventure. This week I had to decorate the world I set up last week. First I had to select the metalcube object from my assets folder and add it to my scene however when I did this Ruby was unable to collide with my GameObject so obviously I had to fix this. To do this I had to go into draw a GameObject using graphic in my project settings. I then had to find transparency sort mode and change my default settings to custom axis. I then had to set my transparency sort axis coordinates to x=0, y=1, and z=0. After I did this Ruby was being drawn in front of the box too early so of course I had to fix this too using the sprite renderer. First I had to select the Ruby GameObject in my hierarchy and find its sprite renderer component in my inspector. Then I had to change my sprite sort point field from center to pivot so that it wouldn't be set in the center anymore. Then I had to rotate the sprite around the pivot point. To do this I had to go into my environments folder and set my Pivot to bottom so then my pivot was set at the bottom of my sprite instead of in the middle. I then had to change my pivots using the sprite editor. To do this I had to select the Ruby sprite from my assets folder and open my sprite editor. I then had to set my pivot to custom and set the coordinates to x=0.5 and y=0. I then had to create a new prefab, add my metalcube to my prefabs folder and adjust the settings. After this I had to make Ruby collide with the objects. First off I had to add a Rigidbody component to Ruby. I then had to disable the gravity so that Ruby wouldn't fall. I then had to add a collider to Ruby and my GameObjects so that she could collide with the GameObjects. I had done both of these in semester 1 for my 3D game so these terms weren't new to me. Unfortunately Ruby still jittered and rotated so of course I needed to fix this. To do this I had to enable freeze rotation box in my constraints section in my inspector however this only fixed her rotation. To fix her jittering I had to add a new void to my script called FixedUpdate and add a new Vector2 position. I then had to make Ruby collided with my tiles as well as resize my colliders.


Comments

Popular posts from this blog

Introduction Post

My Favourite Game: Grand Theft Auto Franchise

Game Alpha