Just wondering if there was an easy way to zoom out the camera when you jump high into the air and zoom in when you get close to the ground. Or perhaps if there is link I could follow to a tutorial?
Thank you
Just wondering if there was an easy way to zoom out the camera when you jump high into the air and zoom in when you get close to the ground. Or perhaps if there is link I could follow to a tutorial?
Thank you
Hi John-Sebastian,
That’s a good question. I’ve never tried something like that in my game but, theoretically, it should be possible to make your idea work. Easy is relative, though.
Rick did something similar in the TileVania game. The relevant video is named ‘State-Driven Cameras’. He defined different states for his camera, for example, an idling and a running state. In the idling state, he has a camera which zooms out. In the running state, he has a camera which zooms in.
The ‘difficult’ problem in your game is to determine when the player is jumping, and what ‘high’ means in this context because you need at least one if-statement to make Unity check for that case.
Once you defined your case(s), the rest is rather simple. As aforementioned, you ‘just’ need two states and two virtual cameras. If you need more effects, you might need more states. In your code, you set the respective state depending on your case/condition/rule.
If you are a beginner in Unity and programming, don’t worry if your idea is currently too challenging. You could complete this course first to gain more exerience, and then you could try to add more features to your Snow Boarder game.
If you do want to challenge youself but get stuck, share what you have here. I’m sure we will be able to give you at least a hint.
Good luck!
See also: