Hot answers tagged

1

Input.GetButton() instead of Input.GetButtonDown() The former checks to see if the key is currently down and outputs true for every frame during the press. The latter checks to see if the key was up last frame and down this frame (that is: true for exactly one frame until released again).


1

The first scenario is called Panning or sort of Parallex without having Camera Follow. It will totally up to you that how you handle behavior of Camera. That means pausing game, move camera ahead, you can do it manually like other objects. In second case I think you are asking about Smooth Camera Follow that would follow your character in smooth manner. ...


1

I think the first one you are describing most closely matches a Fixed 2D camera and the second is a smooth floating or smooth sidescrolling 2D camera


1

Well, to achieve your requirement, I have another work around, place these lines of code in very same script. ... public float _cameraRotationSpeed = 0.1f; ... void Update () { ... ... if (Input.GetKey ("z")) { tiltCamera (true); // Replace parameter with bool } else if (Input.GetKey ("x")) { ...


1

One way to do this would be to clamp (limit) the x and y values of the camera to your width and height of the game. It may look something like this: Clamp method: public int clamp(int var, int max, int min) { if(var > min) { if(var < max) { return var; } else return max; } else return min; /* * var = your variable ...


1

The answer is in your second sentence. Camera is child object of Character. The Camera should not be a child of the character. This is what is causing the camera to tilt. A child will follow its parent's transform. Remove the Camera from the Character. The script @Jon linked to will do what you want by modifying the camera transform, as the ...



Only top voted, non community-wiki answers of a minimum length are eligible