FGear Vehicle Physics (v1.4)

Okay here is the stack trace:

Red underline is FGearSkeletal AddCustomPhysics begins…

And it only happens in multiplayer. If I play in standalone in editor (pie), then it is okay.

I have tested on Multiplayer map in FGearAssets. Also tried with customcollisioncomponent and without any collision. It was working. Just crash when i removed physics asset but not same your error code.
Can you share more information with us? Have you tested on fgear sample projects? or what does the c++ class you add yourself contain

Yes I am sure fgear works well in multiplayer mode… it just doesn’t run in my case… there must be something skipped or unusual in my setup.
It is hard to explain my code without actually giving all the source code… :rofl:
Well I am just looking for some pointers here or tips which will point me to the right direction…
I think I will just look back at the sample or the documentation… just double checking.

  • try change physics type to simulated in physics asset window. Check substepping in engine
  • physics category in project settings.
    if only the vehicle part; If you can downgrade it to run in the fgear demo, you can send me the files privately. Else just skeletal mesh and your custom c++ class which inherit gear vehicle.

I still have not solved the problem… apparently the bodyinstance (physics) is somehow corrupted or invalid or something…
I have put the code to check:
if (mBody && mBody->IsValidBodyInstance()) but it still crashed.
This time I think this is probably due to me upgrading the project from 4.19 → 4.27 and cause all kind of weird issues. So now, I will try to create a new vehicle bp derived from fgear and have it as simple as possible - hopefully this will not crash. And then, I will add back old code slowly…

Yes pls try a blank derived class and use unreal’s example vehicle model (i mean skeletal mesh).

Hi, due on UE5 cascade is deprecated, for the update on the official release, means the particles smoke/tyre will be updated for Niagara? or you will drop support/delete that extra features and focus only on physics?

the focus will be on physics of course but we will try to keep the extra features.

Just to update… finally I have got the built not crashing. Changes:

  1. I moved all the substep stuffs from FGearSkeletal to FGearVehicle because (to me), it make sense as BodyInstance belongs to the vehicle. And I found the call stack to be much more managable.

  2. To actually solve the crash, I have to turn on a bool flag before even Vehicle’s EndPlay is invoked otherwise the crash comes - it is still accessing the BodyInstance but it is no longer valid? The bool flag when turned on, will skip FGearVehicle::tick (so I run APawn::tick instead). Not really sure why the body physics is not valid but now the code runs fine.

1 Like

I think this should be easy, but I spend hours looking for answer to no avail lol…
How do I make the car reverse? I would like to use a keyboard event, when executed then only it will reverse (no auto reverse).

it’s pretty easy, press Z to switch to reverse gear, press Z again to go back to 1st gear.

I have used Set Current Gear before, but didn’t make it (I dont know why). Now I have solved it as this is multiplayer and the code previously run on client. So I moved the code to server, now it is working. I also disabled Auto Change + Auto Reverse.

Yes! Released UE5.0! Looking forward to the FGearPlugin 1.6 update for the new engine!

2 Likes

Looking forward to it too ;), also looking forward to the 5.1 depreciation of PhysX and default engine physics of Chaos, I’m sure Yunus will do a great job for conversion when that time comes.

I’ve been waiting and delaying my project for UE5 which has been a nice break for me also to rethink!

It would be very nice if FGear has deterministic car physics… chaos physics seem to hint that except they dont want to mention ‘deterministic’…lol

there seems to be 2 problems with unreal5 right now.

1-Substepping works differently. It does not work as we expect and simulation gets erratic at low frame rates. On the other hand async tick option is now available which sounds like the system in unity. It works allright(still experimental feature) and it’s the obvious choice to pick when it comes to replication.

2-Sometimes vehicles suddenly stop/freeze while flying. This is a very strange problem and it looks like a physics bug to me. i discovered that if you disable downforce in aerodynamics component this problems goes away but it doesn’t make sense since we just apply some extra force to the rigidbody.

When we address these problems the rest is easy to port we hope…

2 Likes

Is it possible to create a separate custom physics thread for substepping? This is already implemented in ChaosVehicles, in the ChaosVehicleManager class. No problems with Substepping.

about the freezing problem, i can confirm that it’s about chaos physics, you can easily recreate the issue:

1-open chaos vehicle sample project.
2-put the player start a couple meters above ground.
3-put the below code inside SportsCar_Pawn

Untitled

I think there is a freezing problem, related to issues with Tick and Substep. And fixing one of the two will automatically fix both at the same time. I also noticed that at high car speeds, the FPS in the game drops very much.

There are few downloadable fgear demos but the one openable by ue editor is only 1 which is FGearDemo. What about the rest?