Download

Camera Zones, Camera target, Changing targets and managing multiple zones Tutorial

HI everyone,

I just finished my 1st tutorial on Camera Zones, Camera target, Changing targets and managing multiple zones.

It’s a 4 part “series” and this is a my first tutorial so please constructive criticism is more then welcome.

I have 3 videos out of 4 that are ready 2 of them are already uploaded and the 3rd one is uploading as we speak. The 4th video will probably be ready tomorrow but with the first 3, you will be able to make the camera zone work. The 4 video will show you how to change targets on the fly. (ex. following player, then following projectile or showing a special area, then coming back to player.

What will you learn:

  1. Setting up your camera
  2. Setting your camera zones
  3. Setting up your triggers to activate those zones
  4. Setting up the target that the camera needs to follow
  5. Setting up a logic to change target on the fly (ex.: from the player to a projectile or specific area of your map and then back to your player.)

Setting your camera in your scene, referencing it in other blueprints, calculating the coordinates of your camera zone and assigning a target.
https://youtube.com/watch?v=OPSZ4IZKmvE

how to set multiple zones with triggers and how to know when they are activated.

https://www.youtube.com/watch?v=i3v7z-Wlr40

how to handle the camera movement.
https://youtube.com/watch?v=MIFbr3fIjYk

Why I did this?
My game is a sidescroller and I needed the camera to stay within a certain boundary depending on where I was in my level. Also, in certain circumstances, I will need for the camera to follow another target then my player. With the spring arm and camera attached to the player, It complicated things a bit especially when it came to not showing certain parts of my map, with collisions, etc. So by settings my camera like this, I feel I have more control over it and it stays where I want. :slight_smile:

So hope this help some of you out there and happy game deving everyone :wink:

Click here to view the playlist on YouTube

Hi everyone,

Here’s video #4. In this video, I will show how you can change camera targets in a very simple way. (2 test cases actually :wink: )

https://youtube.com/watch?v=5E7jnl0KPlk

Feel free to leave me a comment

Happy Game deving everyone :wink:

I notice that for some people, it wasn’t clear on how to get the camera away from the player.

In each of your level blueprints, you need to add the following:

Image 1.png

It can be added in a function or not but it must be attached to the Event Begin Play.

thanks and happy game deving :wink:

This tutorial was done in 4.7. to make it work in 4.14, if you are having problems, pleaase download the sample project that I’ve made here → https://drive.google.com/open?id=0B51exy1a0ddxc0g2cVFNOVoyZm8

I’m curious what changes you did specifically to get it to work, what area’s should I be looking at to see the changes?

Hi Aumaan Anubis,

Thanks for pointing it out… I forgot about that little but very important part.

First, none of the code for the camera blueprint and trigger detection in the player’s blueprint has changed.

What you do have to look for, are:

  • The configuration settings in the world outliner and the blueprint of the camera (Class settings).
  • The nodes that I’ve added (Set View Target with Blend) to the level blueprint (not your menu scenes, but your game scenes where you will be using this camera) (It’s accessible by the menu just above the viewport).
  • The nodes that I’ve added (Set View Target with Blend) in the Character’s blueprint.

https://drive.google.com/open?id=0B51exy1a0ddxc0g2cVFNOVoyZm8

@maparizeau

Thanks for the details! I really appreciate it :smiley:

Hi maparizeau,

Thanks for your tutorials. They’re very helpful.

In my game, however, the player can zoom the camera in and out (to the zoom roof and zoom floor). Right now I have it setup to switch camera zones when halfway between, however I would rather change it to a smooth transition between the two zones, as shown in the image below. Any ideas on how to accomplish this?

CameraZonesGraphic.jpg

Additionally, I would like to make it so that based on what camera zone it is, it knows which two zones to pull the values from, that way I can have multiple zones with an upper and lower zone. Hence, the Camera Zone 1.1 and 1.2 in the image. The triggers also need to know how to switch to the exact clamp value between the two zones, based on how close to the zoom roof they are.

Can you help me with this problem?

Hi Mewbits,

What variables, from the camera zone script, are you changing when trying to zoom?

When changing zones, it sets the Zone Min and Zone Max. Currently, I simply have it change the camera zone from 1.1 to 1.2 using the on camera trigger event.

So maybe I should have it get the zone min and max for the zoomed out zone and the zoomed in zone at the same time, then treat those as a zone zoom roof? Then I set the location to the location of self but clamped with that value.

Do you use lerp when zooming which allows a more smoothing transition?

Also, there are some variables that need to be adjusted since your camera is closer. Just on the top of my head, you have the smoothing (since you are closer when zoomed in), margins (they might also be different because of how close you are) and CameraHalfWidth.

What I suggest, is that you zoom out completly, figure out all of the variables values. Then, zoom in completly and figure out those variables’ values. Once you have those, lerp between them while zooming. It should allow you to have a more smoothing transition. But of course, this is a guest since I don’t use zooming in the my game.

Hope this helps.

Okay, Let me re-explain my problem. I don’t need anything except a new function that gets a point in between two camera zone’s min and max. I’m using the advanced turn based tile toolkit, and I do not use the smoothing or margin.

ZoneZoomPointExplanation.jpg

I have made it so that every time it gets the zone min and max, it also sets the zone min and max for the next zone in the zone array. I will always have it setup where the bottom zone is the next zone in the array, and I never actually switch to that zone. I have a roof zone min and max and a floor zone min and max. I will set the zone min and max to use when clamping with this new function, after.

In short, based on the two orange dots and the blue dot, I need to find the Green dot.

Edit: So, Looking back at the toolkit, it does something similar, but not quite.
I need to get the distance between the two vectors, then multiply it by the timeline float value and that is what I will set Zone Min and Zone max to…

Any chance you could post the changes you made to the blueprints? I tried downloading the new project but its unavailable. Im using 4.20 so still not sure if its compatible, but would like to give it a go. This sort of camera control is exactly what I need.

Thanks