Lock-on camera

Welcome back to Causality!

Elevator Pitch – “Causality is an action RPG game where you travel through a dungeon to challenge yourself against Monsters. We have a safe area for testing your abilities then a room with a bossfight where your skills are tested. Our target audience is people who likes to challenge their pattern recognition and reaction skills.”


This time i’m going to focus on the lock on camera at the enemies. When working on the lock on camera I cooperated with my design programmer. We wanted the camera to be locked behind the player while facing the boss so you could see the boss properly during the fight if you wanted. So we began by using an old script coded from a tutorial which was used to follow behind the player however the camera needed to be behind the player while still looking at the boss.

So to begin with we used a unity function called LookAt. LookAt set the facing direction towards the parameter object, Then we had to set the position behind the player which became problematic until I finally figured out a simple idea. First I tried to use vector math to set the position from the boss to the player and then further, but this became complicated real fast. So after thinking about it for a while I took the player position – the cameras forward direction from unity since it was looking at the boss and then multiplying it with the distance away we wanted. Now we updated the camera’s transform rotation with LookAt and the camera’s transform position with help of the the players position and cameras facing direction. Then we activated it on and off with a button press.



Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut /  Ändra )


Du kommenterar med ditt Google+-konto. Logga ut /  Ändra )


Du kommenterar med ditt Twitter-konto. Logga ut /  Ändra )


Du kommenterar med ditt Facebook-konto. Logga ut /  Ändra )


Ansluter till %s