Friday, February 3, 2017

Day 4

Today I will be continuing the tutorial and making a camera that moves with the sphere and making walls around the plane so that the sphere doesn't fall off.

So I started off by making the camera object a child of the player object so the it follows it around. But in this case this wont work because the camera follows the axis's and since the ball spins using all the axis it just ended up following the ball as it spins looking like this

So what I had to do was make a script that told it to not spin with the ball.

So what I had to do was subtract the transform position from the player transform position and store it in a variable called offset. Then at the end of every frame (after everything in that frame has initialized) then i made the transform position equal to the player transform position + offset.
This is the code:
:

So I tested this code and it works :D


So I needed to make walls so that the ball doesn't fall off when playing so I proceeded to that.

I made an empty object and named it walls then inside I made the (north wall, east wall, south wall, west wall

Then I made each a cube and extended it an put it around the sides of the plane. 

Now the map looks like this:

And the collision works too:

Tomorrow I will be continuing the tutorial.

No comments:

Post a Comment