Vehicle Template - Free-look third person camera

I posted on another thread, but seemingly didn’t get a reply I think the question just got buried as it looked as if it was answered.

Original Thread: How can I make a free-look camera for a vehicle? - Cinematics & Media - Epic Developer Community Forums

I’m doing exactly the same thing, just want to get a free-camera, not too bothered If it returns back to the normal position after a while or not.

Thanks!

I’ve run into a few problems with setting up! I’m using the default vehicle gamemode, and I can’t seem to get my BP set up the way you’ve setup yours here; forza controls ? - Blueprint - Epic Developer Community Forums

is what mine looks like currently:

As you can see, with the Mesh I’m not able to get the three return values. I’m guessing I’ve missed something? I’m a complete novice to BP scripting, however a third person camera is something I’m in need of just to showcase the exterior of the vehicle I’m driving!

If you could provide any help in a dumbed down way of explaining it that would be appreciated. All I’m trying to achieve is a third person camera, I’m not too bothered about it returning to it’s original position.

Hey MarkyUK,

Sorry I didn’t notice your post unfortunately, but to get the expanded version of these nodes, simply right click on the purple-ish pin and select “Split Struct Pin”, an alternative is to use the Break Rot node you used in the bottom left of pic:

Also make sure to multiply the Pitch by -1 otherwise the camera will move in the wrong direction.

Last but not least, make sure you have the SpringArm setting “Use Control Rotation”, “Inherit Pitch/Yaw/Roll” all turned on, and the Camera “Use Control Rotation” turned off to get to work.

Let me know if you have any other questions, you’re almost there! :slight_smile:

Thanks for the help!

I managed to do all you’ve shown me so far, however the camera still doesn’t rotate? I’ve read through the original thread you responded to again, and it seems you added a few more parts but I don’t fully understand what they are and what they do.

All I’m trying to do here is just to get a third person camera ‘rotating’ freely so I’m able to look around the vehicle. I would have thought ticking “Use Pawn Control Rotation” in the springarm details would have done that, but the camera is still ‘fixed’ behind the vehicle, and doesn’t follow it as it does originally, it just sticks on the one axis.

Sorry for my incompetence/beginnerness, whole new way of scripting isn’t something I’ve tried before!

No worries man, its all good :slight_smile:

If all you need is to be able to move the camera around the vehicle, all of the above is not actually necessary… What it does is allow you to rotate the camera and then it will move the camera back to the default location behind the car when you are not using the look controls, but the basic rotation needs to be added in first.

You will need to setup a couple of InputAxis events as well, go to Edit -> Project Settings and find the Input tab, from here you will need to add 2 Axis events and hook up the Mouse and Gamepad (if you have one) to look like :

With that done, you will now be able to go into your blueprint and set up the input events shown here:

The “Camera Axis Rate” is a float variable that is set to 80, it controls how quickly you can rotate the camera, it is mainly used for the gamepad controller. If you are only using the mouse you can hook up the “Axis Value” from the event directly into the Add Control Yaw & Pitch nodes instead, and remove the multiply, Get Delta Seconds, and the Camera Axis Rate variable as they are not necessary.

With the above setup it should now rotate properly around the car, if not make sure the Use Control Rotation checkbox on the SpringArm is checked, and the same setting on the Camera component is unchecked as mentioned previously.

Let me know if you need more info! :slight_smile:

EDIT: Lol, i just noticed a mistake in the picture above, the Branch node for the Yaw axis mapping should be using the False pin instead of True, I guess that explains why the camera was constantly resetting on me… make sure if you use the method above to swap that pin :slight_smile:

I was playing around with a system for with the vehicle game project (The one from marketplace not from new project) but I imagine it would work the same. I even built in a camera resetting system to spring the camera back into position after a certain amount of time. I start with handling input from 2 axis mappings. They are LookUp and LookRight. They handle MouseY/GamepadRightY and MouseX/GamepadRightX respectively. When any input is detected (I put a if != 0 because these constantly fire. You can put a larger number in there for a deadzone tweak) it adds rotation to the SPRING ARM not the CAMERA.


I have a boolean to see if the camera has moved from its default position (I will get to in a little bit) followed by a call to a custom event. Reset Camera Timer handles the case when the player moves the camera, stops, then moves it again before the timer runs out so it’s always based off their last movement. Checking if the camera has moved is based on TICK as well as a separate function for clamping the camera so it doesn’t rotate in ways we don’t want it to. Once we get input and CameraMoved is true, we call Center Camera and Clamp Camera Angle. Since it’s running in tick, the clamping is constant.

When clamping the camera (it’s a little tricky to find the right values so you’ll have to just play with it because the rotations aren’t always intuitive) it’s relatively simple. We only want to clamp the pitch of the camera (up and down) we want roll to always be 0 unless you want it otherwise, and yaw to leave alone because we want to freely look 360 around the vehicle.

The last step is handling the resetting of the camera which there is probably a bunch of different ways to do it but I opted for a resetting DoOnce node with a retriggerable delay shown below. It uses a simple rInterpTo node to reset the camera back to its original position and resets the CameraMoved boolean to false. The rInterpTo takes a delta seconds input. comes from TICK and I just promoted it to a variable that I set in the Tick event.

_____________________________________________________________________________________________________________________

part is completely optional but if you want to change how quickly the camera resets (with the setup above it is a constant speed, though pretty quick) there is another boolean I’ve added called Camera Resetting that is toggled when the reset process has begun. is needed because of the way DoOnce works and how rInterpTo works. To change the speed, rInterpTo needs to be called on Tick and then you can adjust the speed with the int. There are a few things you need to change. In Handle Input we need to reset the Camera Resetting boolean every time we receive input and the biggest change happens in the resetting area.


Here is how to set up the resetting area to handle adjusting the time for resetting. The value is tricky and I’m not sure what its based on but a value of 0 will yield the same result as before tweak. Play around with it til you find something you like.

Hope all helps :smiley:

Thank-you both so much for your help!

I managed to get the rotating camera working perfectly.

I’ll put the auto-center’ing part on my to-do list as it is something that would be good to have, and you’ve kindly provided the code for it.

I’ll probably invest more time into blueprint scripting as I’m looking to get various other things working on the vehicle, specifically lights.

Thanks again!

THANK YOU SO MUCH!!!

I’ve been banging my head against for hours, trying to get my mechs camera to rotate independently of his legs. worked great with a little tweaking.

Now to figure out how to have him fire at and rotate his torso towards the reticle…but I think I’ve found the solution to the latter in AimOffsets!

I don’t have much experince with UE4, can anyone tell me how to get the 3 nodes that I circled 937cfa5bf5c7cf73c916c707075fe319d8b35c2c.jpeg

Did Unreal ever update where you can change “Use Control Rotation” at run time so you can switch back and forth between free look and the camera following the vehicle?

did you get an answer for ?