FGear Vehicle Physics (v1.4)

Very interested in the UE5 support. Already bought the plugin and got the driving car close to my needs in just two days.

Some questions:

1.- About UE5, in case we still want to stick with physx will be possible? So will support both, or will be deprecated to focus only on chaos?.

2.- Maybe a bug or maybe this is how is intended to work, but if you brake while accel the brake lights not works, it should work always that brake is pressed right?

3.- Problem doing 360º like in the video. Using differencial type:Open in rear wheels helps to drift back, but when you try to accel after the reverse is done it looks on change R/1 gears brakes the car ¿? .

I tried with friction torque 1.0 & Rolling resistance 0.1 to boost acceleration in low cases to avoid that stuck, but nothing.

So, i guess maybe can be in the transmission change time, clutch, etc… but nothing seems to work, the brake lights are triggered when i try to accel after the spin and change from R to 1 gear so it looks some brake is triggered :frowning: .

Or im missing something?

very nice video, congratulations.

1-it already works with ue5 and physx, the answer depends on how unreal engine will support both engines, if you will be able to switch from settings then we can support both but if one of them requires separate source compilation then we might stick to the default one. also if epic decides to depreciate one of the engines then we will also do the same.

2-by default standard input component uses combined axis input. in order to throttle and brake at the same time uncheck “Use Combined Axis” setting.

3-gear change takes both wheel speed and body velocity into account and there is a small threshold between 1st and R gears. this default behavior is safe and works fine but if your game requires more aggressive gear changes then you might need to modify the source code.

1 Like

Hi, I’m having plenty fun playing around with Fgear, however there’s one thing I still can’t get my head around despite trying to play with most of the options -

How do I get the car to be more “controllable” at very high speeds (200+ mph)? At this speed with my current settings, the grip is so strong that turning right then left basically causes the car to either turn way too hard in one direction or turn out of control in the other.

Basically, I want almost the same ease of turning and grip I get at very slow speeds, on higher speeds. Or to put it another way - I want easy, ultra arcadey steering at high speeds.

Thanks to any pointers :slight_smile:

can you try the F1 setup in this demo

it handles quite well at high speeds but you can not make sharp steering since it’s a rather realistic setup. is this good enough for you or do you also require sharp steering at high speeds?

Have some problem that don’t know why, but at some time after doing stuff in the editor, the skidmarks, smoke… not appears when try to play the game in the editor. Any idea what can be?

i didn’t hear such issue before but it could be about the way unreal works with component settings. when you change a component parameter, the engine destroys the component and recreates it with the new parameters. may be the effects component has an issue with that but i can’t say for sure, could you tell me a couple steps to recreate the issue or does it happen randomly?

It looks randomly, since i posted i not had again the issue, but if happen again i will check the effects or remove/add again to see if fixes.

Btw I detected something weird with the skidmarks not matching the tyre, so i enabled gizmos:

When more speed, more difference between the real visual tires and the physical ones. What happens? It does in all cars i tested. I thought maybe was something i edit so i downloaded the FGearExample and same.

This causes the skidmarks not match the visual tires and other collision stuff due wheels are on XYZ due speed, but on collision it goes to the correct ones and if there is an obstacle it kicks the car to the sky.

So, why this happen? Anyway to fix this issue?

Edit: This is a Plugin bug or PhysX related? I mean, maybe with chaos it does better ¿?

it’s hardly a bug, if you try to draw a debug line from the vehicle actor location you can see the same delay.

we use functions from DrawDebugHelpers.h like DrawDebugLine, DrawDebugSphere etc. and it seems that this kind of delay happens(not sure why). the same goes for the skidmarks, the mesh generation might be delayed for a frame.

i don’t think its related to the physics engine(we fetch locations from both physics and bones), using an extrapolated location might work, i will try to come up with a proper fix and let you know.

So if i understood you well, the physical tyres on the car are placed OK, is just the gizmo who has that delay? Then i guess i have to find why that happened on that collision, my second suspect are the suspensions.

Then the gizmo and skidmarks have the same delay, due skidmarks are placed correctly just in the center of the tyre gizmo.

physical locations are correct.

i’m not sure what kind of collision problem you experienced but we have seen issues with spline meshes but the problem was not about fgear.

gizmos, skidmarks seems to be inherently delayed, we will try to find a fix for that.

Hi @Davit_Masia
1 - Draw debug function works slowly but physics is fine. Please don’t mind the delays.
2 - About skidmarks, you can type smaller value to “Skidmark Min Distance” in FGearEffects component.
3 - I don’t know why the effects disappear after a while. maybe it gets deleted at garbage collection time. Did you type UPROPERTY when defining the component?

Ok thanks. And more than one day without get that effects error, i guess due how i do now all tests.

Now, im trying to fix/improve another behaviour on wheels but not sure the best way.

I want to achieve this:
https://imgur.com/RysFCOT

When the lateral camera appears you can see the car brakes, turns, goes back, then start to go forward and all the time the wheels rotation are full due accel.

Actually trying to do the same, but if the car goes back the tires rotation too, stop and then go forward, instead of go forward all the time due accel.
https://imgur.com/EQmO931

You can see there is a moment the wheel rotation go back and then changes to forward.

Ive been doing tests and seems with mass 1 on wheels does the trick (until certain negative speed) but then the driving changes completly as it should and needs a reconfig for all.

So, wonder if there is a better way to achieve that ¿?.

Last idea, due is mostly on handbrake, is add another edit in the core to set mass to 0.1 on handbrake, then on release lerp to default, so be able to accel while goes to default without tyres rotates backwards.

You can try disabling ‘Allow Wheel Rotation Against Engine’ option but it might be undesirable to have it permenantly disabled.

Not worked for me, the wheel just stops, then, when it can, starts to go forward when it should be rolling forward all the time. I guess i need to do something related with friction but dont know what can be the best aproach to not mess the entire config.

you might try having higher torque at lower rpms and/or some trick with the tire mass.

i checked the source code and it’s kind of a design issue that wheel speed is strictly tied to ground speed and changing that code can be dangerous, it requires a good model to behave better and a lot of testing to make sure everything works fine. i added this to my long term todo list but do not depend on me, i may not be able to find a better solution.

I see, thanks for the reply i will try the torque/rpms too.

Btw driving around 90% as desired, are just that small issues that takes too time to get done.

Edit: Same with the R gear. If i go R, on press accel it should put the 1s, instead the R speed decreases, sets N and then 1s. Hope to find the way to achieve a good combo for all and keep the actual driving feeling.

Edit2: Doing some debugs just realized that when you accel in R gear, it really triggers the braking… then on 0 speed, set N then 1 and then triggers the real accel. Im gonna do some experiments.

1 Like

Well it looks i achieved the behaviour, still testing but looks promising.

At the moment the condition only triggers when you accel if car have X negative speed with:
“mLocalVelocity.X < 0.0f && mAccel > 0.0f”

That is when most is needed, so the actual driving remains the same.

Also added set gear 1 if you accel on reverse gear, so the 0.1 mass trick also works in this scenario.

You can see there is a moment i go reverse and press accel slowly and short times and the wheel try to spin forward no matter the car inertia, then on release it continues going back and wheels too like it should.

It may looks at some points the wheels are not moving if you see the radials, but check the letters in the tire. Just is too low mass for that low negative speed that spins too much that gives that effect.

Actually i set mass 0.1 to be sure, but if all tests are ok i will add some lerp and formula to change the mass from 0.1 to 1.0 max in negative speed and lerp to default when positive speed or accel is released to give a smooth effect as possible.

I think the trick can be achieved on positive speed too and keep same driving, but in this case will need to have in mind:
throtle force 0-1, rpms, mLocalVelocity.X… and some kind of “SpinWheelFactor” so 0 is like default, then on higher values you set how much spinning effect want in the wheel, if you add too much then wil look you are always in an ice road.

2 Likes

Finally i found the collision bug and the way to trigger it always.

It looks if the wheels surpases some object it tries to jump/push out, which kicks the car to the sky.

It does similar with the physics body collision but i fixed with this:

Now on high speeds the car not bounces like a ball. I set 0 to be sure it works, the idea is leave at 0.1-0.2 or similar.

But no idea how to fix this on wheels to avoid this:

To trigger always the bug i did this, to be sure the wheels contact to the mesh:

Is because if the collision is tight to the car for good collision and if you collide on high speed on steer, sometimes the wheels reachs the mesh and kicks the car to the sky.

In the object properties i saw something , not worked, no idea if i can set wheels as “character” to be able to use this? Is possible? Where?

So, if im not missing something and this is how FGear works, i ask for some option in Fgear Vehicle->General to tell the % a wheel can step up.

For example in real life a car can go over some obstacle if it is around 40-50% the wheel radius, all depends of car throtle and friction with that obstacle but you get the idea.

Or in Fgear Physical Material to tell yes/no.

What you think?

this is how raycasting works, to avoid those cases you either keep the ray origins inside the vehicle body collider and/or modify ray trace settings in “GeneralSettings/Tracing” to avoid geometry other then the ground. you can have multi raycast to climb smoother but lateral climb is not possible, if the ray hits a geometry it will try to climb instantly.

Trying to improve the last driving behaviour, want to reduce the time to turn in this case:

Tried various drive assists for steer: in general, in arcade assits and on inputTranssmision but the unique thing that does what i want is increase the longitudinal force scale in front wheels.

Ok, but is applied always, and i only want that extra on that situation.

I checked ArcadeAssists code and updateTractionAssist gives that extra traction lng&lat but only on low speeds, the sliders on editor is set to max 50.

So, i need that extra traction working on any speed, in my case only longitudinal in front wheels and applied only when car steer/rotates due inertia to one side while you steer+accel to the other side to reduce that time.

Also add the car speed% to the formula, due on low speed you will need less extra traction.

But no idea how to achieve that. Suggestions?