FGear Vehicle Physics (v1.4)

why don’t you consider porting that code to BP, all those functions are exposed…

Because it is linked to the RPM of the wheels, it only works when the vehicle is moving and loses power when climbing, but the vehicle stalls every time it starts moving (since the wheels are stationary). Another problem is that it would need to constantly check all four wheels, these constant checks on mobile platforms harm performance and would also not scale well if it were for a game with 6x6 or 8x8 trucks. It also does not work well with the semi-automatic gearbox (sequential with automatic clutch).
Another problem is that it is also possible to stall even with the automatic gearbox (without Stall Assist). It is very strange to have the accelerator at maximum, the engine running and not have any feedback from either the wheels or the engine revs.
It would be better if the stall was linked only to the engine, but would it be very complicated to unlock the RPM limit below idle? Would it compromise the correct functioning of the plugin in any way?

you should be able to prevent stalling at start by doing some extra checks on clutch, speed etc. this logic would only apply to manual transmission, turn off stalling for auto.

you don’t need to check all wheels, use getMaxWheelKMHSpeed instead. btw BP is slow for math code, use native code for math heavy stuff.

we might consider adding this feature with the next update depending on it’s complexity, no promises.

Great, I hope this is something simple to implement. Thanks!

@lazybitgames Any eta on the next update or support for 5.5?

probably next month.

Hello, I want to make a HUD and add nitrous but I can’t find how to get the speed values.
Where would they be?

There are functions to get the speed. In Kmph,mph and unreal units.

Could you tell me or show me where they are?
Since from FGears I find set and gets, but those do not work correctly for me

here is a couple of functions you can use:

GetKMHSpeed: vehicles forward speed in kilometers per hour
GetForwardSpeed: vehicles forward speed in meters per second
GetVelocitySize: vehicles overall movement speed in meters per second
GetMaxWheelKMHSpeed: the speed of the fastest rotating wheel in kmh

1 Like

Thanks for the answers, I had already tried those ways without results.
With these functions I obtain the data, but not how to modify it because they are GETS and they should be SETS to be able to change them

You asked how to GET the values. If you want to add nitrous, you can add impulse to the mesh on a timeline or you can increase the torque (I’m sure there is a setter for that) and max rpm etc. There are many ways to do it.

2 Likes

@lazybitgames How to get than on brake, all wheels reduce speed until 0/stop at same time?

I tried with setBraking, maxBrakeTorque and tried with setSpeed in axle(using L-S-D) adding a version of the dominant wheel behaviour in DF_Locked but seems is not a good idea or something else is messing the numbers.

So, wonder, what will be the best way that on brake, all wheels, no matter their actual speed, goes to 0/stop at same time.

Im using L-S-D as differential in both axles with 0.5 strenght.

@lazybitgames any ETA on the next update?

I don’t understand what “get than on brake” means, please clarify.

@gurusaint hopefully before the end of this year

Sorry, I mean on brake.

Actually on turning and brake, some wheels goes to 0 (mostly no gripping rear wheel), while the others is at 50-60 or similar.

What im trying to achieve is, on press and hold brake = reduce wheels speed to 0/stop at same time to avoid one or other wheel goes to 0 sooner than the others to get a more stable braking.

Latest version compiles fine on 5.5. Just had to make changes to the header files of fgear custom collision. I’m guessing we’re getting some goodies in the next update :blush:

that doesn’t sound easy. normally brakes work straightforward, apply a constant stopper torque to each wheel. you would need to apply different brake torques to each wheel based on their speed and traction. do not try to set speed manually that won’t work, the only way is via Wheel.setBraking but finding the correct numbers is no trivial task.

Then i wonder how Dirt Rally 2 does. On brake it reduces wheels to 0 at same time.
I checked and disabled all helpers to full simulation and still does.

This makes on turning or drifting the car follows/continue the curve but slowdowns.

If not, in my case, due some wheel goes to 0, like rear non-gripping wheel, it makes the car break the drifting/curve and turn/rotates in a sharp way.

The best thing i got, for one side is use the v1.62 for breaking(feels smoother):
mFeedbackTorque = FMath::Abs(mWheelTorque) +absLngFriction;
Instead of actual v1.81:
mFeedbackTorque = (FMath::Abs(currentForce) + absLngFriction) * mRadius;

And then edit the braketorque based on carAngle different for each wheel:


Using CarAngleR( Rear) due using the front ones, with much angle it increases.

This is the RallyCross car setup on the game:


One idea i had is maybe on brake reduce with some fast lerp the Diff Strenght from 0.5 to 0 and similar stuff trying all wheel params gets the same as possible on brake.
RallyCross cars seems not have ABS(seems they are banned), i tried to remove and wheels got locked sooner but still there is a difference than can cause some bad behaviours in some scenarios.

So, any chance to support L-S-D Braking too? like in Dirt Raly 2 screenshots?
On braking > Different strenght than driving.

And maybe some slider to set the time, 0=suddenly or X=gradually.