I am messing around with chaos vehicles and I got it right for the car to drift with just tweaking the Vehicle Movement Component but I would like to implement a steering assist into the vehicle I am using. Basically I want the wheels to point forward when the car is sliding. A similar effect can be seen in games like Assoluto and CarX drift racing.
Is this entirely a visual thing, or is this an actual control thing?
If itâs visual, youâll need to insert yourself between the computed/simulated state, and the rendered state, to render a different mesh than whatâs used for computation. Make sure the render mesh is rendering but not colliding, and the computed mesh is colliding but not rendering.
If itâs actual control, then perhaps the best way to do this is to wire this up where the player control is read in the controller.
In the âinput axis steer rightâ event, you could check whether youâre drifting (or, perhaps, even calculate âhow muchâ assist is needed,) and then calculate what you âwantâ the steering to be, and then calculate some blend of the user input and the desired input, and forward that to the physics component. This would also let you implement a setting in the UI for how much steering assist the player wants; youâd simply use this setting as an input to the function for how much assist to apply in the blend function.
Thanks for the response bud. This is entirely for control, itâs kind of a necessity as the car spins out because I can not react quick enough. Forgive me I am very new to Unreal Engine, have only been using it for a few months. Is it possible to show what you explained in Blueprint form? So that I and anyone else who has this idea can use it in our own projects?
You would need to adjust the direction of the steering programmatically with trigonometry.
From the car forward vector, look at location with B being a point on the spline you are supposed to follow.
Well, ok. Since you are new to it maybe a bit more info is needed.
Cars travel on roads. Roads are made with splines.
Fetching a point on the spline close to the car (or character) is fairly standard.
In this case, I would do it with a cone sweep though.
Because if the player turns opposite it will eventually disable the correction.
So, a cone sweep detects the spline, and calculates the point on the spline at the edge of the cone.
With that point, and actor forward vector, you solve the angle at wich the steering needs to be adjusted.
Then you slowly correct the angle the player is inputting by adding in a fraction of the angle you need and updating the needed angle.
The result should be similar to fake steering where you donât have to do anything for the car to follow a path, but you can still have some control to alter the path / micro correct.
A cone being tighter at the start than further out, could possibly mean that some drifts will put you in a spot that auto steering cannot work.
You have to try it out and see where collisions happenâŚ
This method seems very limited. I want this to work everywhere, even off road where you drive on a landscape
If the user is driving on an arbitrary landscape, how do you know where they want to go?
And if you donât know where the user wants to go, how can you âassistâ them going anywhere?
Basically I want the car to turn the wheels to correct a slide. Below is a video that shows what I mean. Watch from 3:11 to 6:12
I pledged on his patreon and downloaded the component but the vehicles are physics constraint vehicles and I am using Chaos Vehicles. Also his component is written in C++, something I know nothing about. I want his steering correction feature (or something similar) in blueprint form that works for Chaos vehicles.
Sorry if I did not explain well enough what I meant. If more example footage is needed, let me know.
If you can alter the steering input for the player, then thatâs pretty simple.
- Get the âright vectorâ of the car chassis (in world space)
- Get the chassis world velocity vector
- If the velocity length is smaller than some number, donât correct anything and stop here
- Normalize and dot product the chassis-velocity vector with the chassis-right vector
- Multiply the value you get out with some scaling factor (start with 1.0 and tune up/down from there)
- Add the result of this multiplication to your steering input axis signal, and clamp the result to the [-1 ⌠1] range
- Use this result as the actual input for âsteeringâ in the car controller / physics
The math result of this is that âthe larger the part of the cars velocity is to the side, the more steering correction is applied,â which works great for correcting drifting (four-wheel skidding.)
If you also want to correct two-wheel skidding (fishtailing) then youâll want to also get the cars rotate velocity around the up axis, multiply by some factor (may be negative, depending on how rotation is measured) and add that, too. This will correct more the faster the car is turning. BUT this will also make the car have more understeer, because the car rotates when just turning, too â just not as much.
@jwatte You sir are a genius. Thank you so very much. This has been bugging me for months. Here it is in blueprint form.
I wouldnât call this a âsteering assistâ.
Maybe thatâs why you couldnât find a satisfactory solution up to nowâŚ
This is more of a traction control solution - you are literally compensating for the engine simulation by increasing the steering power.
The âcorrectâ solution would be to alter the actual physics that are calculating the slide in the first place.
Not sure how far the engine has gotten with implementing chaos vehicles - will check on it in the coming week actually.
The point being, it should be possible to alter the values to achieve a controlled traction (more grip) similar to what you are doing by adding into the steeringâŚ
Hi,
I need something similar. I like the ChaosVehicleComponent. Easy to set up and get going, if your aim isnât arcade racing.
As Iâm creating something like Split Second: Velocity, I need to maintain most of the speed while cornering. And just like you, I also need to easily be able to get into a drift, keep it going and controlable.
This is the logical solution to it https://youtu.be/n_A0RqeGado?t=1133 .
Thing is, I have no trouble finding logical solutions, but on how to actually implement it⌠. So many tutorials on the basic stuff you even find in the documentation, but not the parts you actually need help in. Iâm still new to game-development and Blueprints. Although Blueprints make it a lot easier, itâs still something I need guidance in, without getting to technical. (Iâm not a hardcore programmer or mathematician. I come from a background of webdesign and databases).
Iâm generally also not keen on copy/pasting code, as that way, I wonât learn anything. Can anyone point me to good tutorials on this subject (or racing games), preferably in unreal.
I was also looking into disabling the Mechanical Simulation in the Chaos Vehicle Component and drive it through with a sphere (for drifty arcade control), but Iâm having trouble with it when trying to rotate the sphere left or right.
Chaos Vehicle Component also has an âArcade Controlâ section. I figured out the âStabilize Controlâ, but canât figure out the âTorque Controlâ and âTarget Rotation Controlâ. I have a feeling they are there to do exactly what is described in this thread, but have no clue on how to adjust those settings, what is what for and such. There is no documentation on it.
Cheers