FGear Vehicle Physics (v1.4)

higher longitudinal slip will lead to lower lateral friction, this is an inherent behavior of the pacejka tire model. the combination of lateral and longitudinal forces can be configured via the lateral & longitudinal combined slip parameters of the tire model (for tire96 and mf6.1). fgear has accurate implementations of these tire models but tuning tire models is a black art.

tire model is one side of the story though. another important factor is the drivetrain simulation. fgear’s drivetrain is not simulation grade, has some approximations and possible inaccurate parts. this may or may not contribute to the problem. rewriting the drivetrain could only be a subject of a future fgear2.0 project which is currently not planned.

for all those asking for drifting physics I usually say fake it until you make it but that requires the necessary knowledge to modify things around the code and a lot of time & experimentation.

@lazybitgames
Another little problem, maybe a bug, if you start the engine and the transmission is in neutral, the engine does not rev when throttle is pressed.

Did some fast test, very rudimentary, but got something working with my actual setup.
Using only on 1st gear atm. Use them with your setup/formulas/lerps, etc…
You have to use them with Front/Rear wheels conditions.

//
float pAccel = mVehicle->getEngine()->getThrottle();
float aLngAccelF = 1.0f + (0.4f-(0.4 * pAccel)); // Fron - mLngScale
float aLngAccelR = 1.0f + (2.0f-(2.0 * pAccel)); // Rear - mLngScale

float aLatAccelF = 1.0f - (0.4f-(0.4 * pAccel)); // Fron - mLatScale
float aLatAccelR = 1.0f - (0.6f-(0.6 * pAccel)); // Rear - mLatScale

float mDefaultLngFriction = mAxle->getWheelOptions()->getLongitudinalFriction();
mLngFriction = mDefaultLngFriction / mLngScale;
//

There is no min/max, velocity to get optimum friction again and other stuff i mentioned in the previous post, but thats the idea.
Atm is just based on accel pressure but already gives an idea about the behaviour you can achieve.

From the first tests, im pretty sure getting something like in the videos is possible, but yeah it gonna needs lots of trial/error and value tweaks to get a decent one that works well in all scenearios without mess with the overall driving.

@lazybitgames How can I make it so the third person camera doesn’t go through walls

like this https://youtu.be/o2vfPxbHn5Y?si=KO-oc8pdx7oHRo_h

it’s all about doing some scene queries and positioning the camera accordingly.

and how do you do this with fgear as im look in the blueprints and cant find that camera in the actor

you can’t do it with orbit camera unless you do it in C++.

you can try the spring arm approach in that video, it’s quite simple.

Hi, Are the bus physics suitable?

there is nothing special about bus physics other then it’s a larger vehicle. so yes you can have buses in your game.

@lazybitgames, did you have time to look into this issue?

“if you start the engine and the transmission is in neutral, the engine does not rev when the throttle is pressed.”

(I’m afraid it got unnoticed among the other posts in the same period)

yes, missed that one.
I see the problem and have a fix ready.
you can drop a mail if you want to get the code change(if you can compile the plugin yourself).

1 Like

Thank you for resolving this issue, it’s a small detail, but it may bother some players.
Since my game is still in the middle of development, I can probably wait until the next update. Thanks

1 Like

Having some issue doing donuts or drifting around objects, due the car is angled the brakes stops the wheels too sharp.

If i go straight holding brake+accel, the car wheels still goes max at 1st gear, hitting the rpm limiter which is expected.

But on steer, when more angled is the car it losses wheel torque more fast until stops completly.

Thats with ■■■ in both axles no matter Diff Strenght. With Diff Locked works more as expected, speed is reduced but not to 0.

Wonder if the ■■■ implementation is correct or there is some issue with some lateral formula.

Checked the “FGearDifferentialType::DF_■■■” on FGearAxle, and it does a lerp between open-locked using DiffStrenght for time.

But with ■■■, using DiffStrenght to 1.0, not should get the same behaviour as locked?

Edit: LOL, UE censures " L S D" XD

locked diff has one difference then l.s.d with %100 power. we make sure the wheel rotation speeds are the same when the diff is locked, see UFGearAxle::postWheelupdate.

1 Like

Oh! interesting. Im playing Dirt4 and DirtRally2 and on brake in that conditions and based on handling options, or never stops or it does smooth, maybe even adding less friction or a bit more slip to make it less sharp pressing braking for a better management, so the car still goes but seems slips more from rear(or gets more revs there) giving more precision range.

Also i may increase revs and max speed on 1st gear to help a bit more. Already tried tweaking the engine with limiter time/friction torque/inertia but not does a big thing.

I’d also like some way of the power/wheel speed to not decrease when turning, not sure if this is what you are sort of trying to achieve @Davit_Masia but @lazybitgames is this possible?.

Even if was was switchable to totally remove the power/wheel speed dropping when the wheels are turning this would be a massive benefit, I have many vehicle types and to have this functionality would be a massive win.

@PerfsPC In my case im talking about turning with accel+brake or while doing donuts or drift around with already lot car angle.
/

@lazybitgames Tried some fast things but not get working as wanted, lot of understeer.

Doing some tests i will need, on brake+accel, to Front-Rear axles, slider options for:

  1. Min speed on full accel+brake.

  2. L.S.D Checkbox to tell if both wheel keep speed from dominant wheel(As LOCKED does) or DiffStrength based. If Diffstrenght based, example:
    If min speed is 40, that goes for dominant/gripping wheel, the other less, based on DiffStrenght setup in L.S.D.

With something like that, we should be able to configure better the driving in the mentioned scenarios.

1 Like

Alternatively or as extra to point 1, maybe some ratio to customize the decrease of wheel torque by car angle when brake. So it can still goes to 0 if too much angle, but we can manage to avoid the car stops sharps when reach certain angle, and being more permissive / smooth.

Got a first sketch of the braking behaviour i was looking.

In the video i just use the brake to keep the drift and show the car behaviour. No more suddenly car stops / fast rotations when brake in this scenarios.

Atm no lerps, gripping wheels, accel or currentSteer taken in account on formulas for a better smooth/accurate feeling. Just braking and car angle.

Still hard to control, but with previous missing stuff mentioned + feathering/throttle control with Accel on pressure variations should give all control needed.

Here the WIP code that works with my actual setup to give an idea how is made:

1 Like

Looking good there… keep at it!