Day 12 – 18: Real work on Camera System

Blog / Game Development

Screen Shot 2014-12-21 at 2.43.50 PM

Play the Game Now

Well, this was a lot of work.  The camera system needed some real work.  I originally thought I could set two game objects between each other and have a float go from 0-1, placing the camera between dependent on where the player was.  Tried using a Lerp, but lerp is completely dependent on time, not floats.  Therefore, did some really crafty system where I create 5 Vector stops between cameras so as the player moves a certain distance, the camera Lerp’s to the next position.
So what is a Lerp?  It’s a smooth transition between two game objects based off of time.  Normally, if you use a transform.movetoward or transform.translate, it’s a constant move.  A transform.position is just a move from point A to B with no animation.  Lerp if used like this:

currentPosition = transform.Lerp(Gameobject1, Gameobject2, time.deltatime);

This type of code creates a smooth position change between two object Vector3’s based off of the time.  Since the camera now generates 5 Vector3’s, it looks like the camera is changing position based on the player where in fact, it’s moving to another gameObject based off of the player’s position.  Crazy workaround.

Next, I spent some time building the level design in the game and am starting to assemble those in 3D.  I figured with the camera system done, the AI working, the character movement working, and the item database functional, time to build a freaking game, right?

As levels are finished, I’ll post them online.

Leave a Reply