Download

forza controls ?

I want to set up controls just like Forza where the car can move independent of the camera and the camera can rotate without turning the car.

So arrow keys turn car while mouse turns camera.

please help. I’m new to Unreal 4.

I’m trying to set up controls where my mouse turns the player forward left right etc. but the camera can rotate freely like a free look kind of thing.
The camera should follow the player but rotate independently. Any help please.

Hi there, I did something similar to this recently, here is how I set it up:

This is a custom event I created to move the camera back to behind the vehicle:

carcamera1.PNG.jpg

With that created I called the event any time the camera was moved or the car steering was changed:

4b259956287a50e37deadb725be7c97688bb2b03.png
06f38d8db5f0954d816f68d7f89775b238cf3aa7.jpeg

In the second picture I have renamed the “LookUp” and “LookRight” (not sure the exact names) input events to be “Camera Pitch” (look up/down) and “Camera Yaw” (rotate left/right).

The custom event contains a “Nearly Equal (Float)” node for each of the axes with an error tolerance of 0.05 degrees, once the value gets to this point it is not necessary to keep updating the camera position, you would never notice the difference and it saves from having to calculate any further. Also the Pitch is multiplied by -1 to get the correct rotation results.

Also make sure you have “Use Control Rotation” turned ON for the SpringArm component.

Hope that helps! :slight_smile:

how do you add a “Add Pin” node ? I’ve seen them but don’t know how to get them.

one is connected to the “camera axis rotate” node and “get world delta seconds” node in this last picture here in the lower left side of the screen.

Thank you soo much for this, I will try this.

Thats a Multiply(Float * Float) node.

The “Add Pin” bit automatically shows up on certain nodes, for instance a Multiply node (float * float), Subtract, Add, or a Sequence node (among others) has the Add Pin by default. If you add pins that you don’t need, right click on the pin and you can choose “Remove Execution Pin” to get rid of it.

So basically it is added by default to nodes where multiple inputs make sense, there is no way to add it to a node without it. :slight_smile:

ok I’m at the first picture and I can’t find where I can get the node “camer Pitch Offset” that connects to the “near equal float” node.

That is just a float variable I created to hold the default pitch value. I set it to -15 so the camera is slightly above looking down at the car. You can just enter -15 into the pitch value instead if you want, either way works, I just wanted to be able to adjust this from the defaults menu instead of hard coding it into the blueprint.

also are is the “camera axis rate” node a variable ?
I tried looking for the same “get world rotation” nodes as you did in the first pic with the 3 different return values like pitch and roll but the only one that came up was the one with one blue return value like the one connected to the “spring arm node”
same with “Delta rotator” its not the same as how you have it.

I tried the search bar and dragging the end values to get a possible nodes search to come up and still could not find those.

I also tried making the “steering input axis mapping” screen shot but I could not find some of the nodes I figured I’d have to create them but I’m not sure if they need to be variables.for the “set steering input” node how did you add a green steering node connection piece ?

sorry I’m new at this.

this is what I have so far. I added nodes that prob don’t work well with others.

screen1.jpg

I think I just figured out how you created all those other nodes.

nevermind the two Q’s above this post.

can’t find two nodes

ok I have my nodes like yours only missing the node “Set Steering Input” from your second pic axis mapping. I’m sure I have to make it I’m just not sure how.

here are pics of what I have so far:
Reset Camera:

screen1.jpg

Steer Inputs:

ecdfd7823617b1e8b313710692471ea990222b7c.jpeg

camera Pitch and Yaw:

112dde8e6c1aa533264d0db29c5c90ee7e863a33.jpeg

it’s just one node.

It looks like you are using the wrong parent class of blueprint to create your vehicle. Did you start out with the Vehicle Template that comes with the Sedan? It looks like you are using a regular Pawn instead of the WheeledVehicle class.

To fix this you will need to re-parent the blueprint. Click on the “Blueprint Options” button from the toolbar, then in the details panel that opens change the “Parent Class” option to “WheeledVehicle” like this:

c1af0c67a26ef71b0285b89fb862f1b1b823d558.png

and then compile the blueprint.

After that we need to fix a couple of issues:

car02.PNG

The “Vehicle Movement” variable you are setting can be removed, as the vehicle movement is a pre-made variable for the WheeledVehicle class. Also you can remove the Get World Rotation node.

Next:

car01.PNG

The Get World Rotation node on the left needs to be the other type, right click to search for the node and un-check the Context Sensitive setting from the panel, then type in “get world rotation”, the one you want is in the “Utilities -> Transformation” section.

Just below that you have the Camera set instead of the Spring Arm, make sure you change this variable to the Spring Arm type.

Last issue is you have the Add Controller Yaw and Roll nodes mixed up, un-hook each of the wires and place the Yaw in “Then 1”, and Roll in “Then 2” and hook up the corresponding float values from the multiply nodes.

Last thing, go into the Components view for the blueprint, select the spring-arm and enable “Use Control Rotation” and “Inherit Pitch” and “Inherit Yaw”. Then select the camera component and ensure the “Use Control Rotation” value is un-checked, you only want to inherit the value for the Spring Arm not the camera.

To ensure you have all of the other parts of the vehicle set properly, please go through this guide and double check you have all of the required components:
https://docs.unrealengine.com/latest/INT/Engine/Physics/Vehicles/VehicleUserGuide/

Hope that fixes it for you, let me know if you have any further questions. :slight_smile:

Hi, I followed your tutorial and now I’m kinda stuck. The problem seems to be the steering part of this, it seems the steering input it constantly resetting the camera, not sure what i did wrong

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?