- Home /
Camera going up with character
Hi I am making a runner game and I m using SmoothFollow script with camera to follow the character.But their is a problem I m facing is when character jumps up camera also jump up with it .I certainly don't want that I want my camera to keep looking at the character and following him without going up
I want it of the pattern same like temple run or any other running game .that while a character jumps the camera do not change its height (move up) with character .And if there is a change of path and the new path is of lower height then the one before then camera should go down with the player/character
Answer by cdrandin · Apr 14, 2013 at 07:02 AM
Ok, you got the camera to do exactly as told. Now if you want to get picky with it then that is when you need to do some of your own code. You can still use the SmoothFollow script, but I figured you learn more remaking your own and take snippets from the script.
You want to disable some y motion or at least not to jump. When you move the character why not move it with respect to the inputs instead of just blindly following the target.
So, if you press "A" character move 5 units to the left, AND camera move 5 units to the left. This is a simple way to solve you problem. Another could be to directly copy your characters position to the camera position, but make sure to forcefully control the y-axis by maybe put a 0 in it then change it, or start an initial position so the camera stays at the same height level and just change the offset whenever you feel you want the camera to move upwards.