FGear Vehicle Physics (v1.4)

Yes sure just one vehicle.
Summary: The marketplace truck is designed with one skeletalmesh + many other static meshes for bodies, tires etc. And the skeletalmesh is naked - it only has bones, that is it. Now I am trying to merge all those into one skeletalmesh.

I have got my issues solved. Basically I have to set collision bodies type to ‘Vehicle’ and then set them to ignore each other (tick).

Btw has anyone got hud shown in multiplayer mode? Hud is null when I tried to access it from controller. Hud is important to show the vehicle telemetry. And hud is asssigned properly in my GameMode.

Is there any way to change the standar camera by a cinematic camera to make use of DOF ?
This: Cinematic Depth of Field Method | Unreal Engine Documentation

I checked FGearOrbitCamera.cpp/.h but was unable to find where to change in case was there.

So, is possible change standard camera by cinematic camera on Fgear? How? Where?

if you check this, there are multiple ways to use DOF.

-in FGear you can access post process settings from FMinimalViewInfo struct but never tried it.
-you can also use a spring arm + a camera component and edit camera settings.
-or you can just add a post process volume and setup DOF parameters.

Already have a PostProcess volume but the dof settings there or in the standard camera not works for me or at leaast im unable to get a good settings. The unique way to get the DOF quality/feeling i want is using a Cine Camera. Setting traking the car, lock focus and other params looks nice.

Then the unique solution will be add a spring arm + Cine Cam? i think the coder already tried this but there was a problem to get the coordinates due the OrbitCamera is created on runtime or something like that.

The idea was use the cinecamera and pass the orbitcamera coordinates to still use the lag/tilt… options to customize the behaviour.

Is that possible, or you mean use a spring arm + cine camera and create the full camera system from scratch?

we used a spring arm + a camera component in our own game but i have no idea if a cine camera is suitable for this task.

orbit camera is an optional component so if you remove it then you’ll have no side effects.

  1. The wheels spin on their own in this position :frowning:
  2. Also, when turning to the right, the wheels dig into the ground. I think the rotation of the wheel in such cases should be blocked in this direction. You can somehow check if there is an obstacle.

yes the vehicle is still in 1st gear so they continue to spin and wheels have no real collider. they can be avoided but some games may need it and some games not. so it’s up to the user, you can switch to neutral gear(or fully brake) when all wheels loose contact and also do necessary checks to limit steering in a similar case.

Maybe you’re using the wrong functions. Because Chaos ticks in a separate thread, you need to call functions that marshal your forces. In a C++ class derived from UChaosWheeledVehicleMovementComponent, try calling AddForce on the property VehicleSimulationPT. This will queue up the force properly for the physics thread. Hope this works, looking to pick up FGear for UE5!

FGear doesn’t use the Unreal Vehicle base.
It isn’t using the PhysX base either.

It’s it own physics calculations.

The problem with Chaos atm, is that it makes heavy use of the physics sleep states. If an object isn’t being focused or interacted with, it’ll sleep the physics object (this is for performance reasons).

I’m still running on 4.27 but will look into migrating to 5.0 soon. Will put my findings here if I solve the issue!

1 Like

I have good news and bad news.

Good : I found a workaround for the freezing problem, it’s ugly but works.

Bad : There seems to be serious problems with chaos collision resolving, sometimes vehicles start flying to the moon with simple collisions.

Ugly : I have no idea how substepping and async physics ticking works right now.

4 Likes

UE 4.27

I want to fix the replication system in your plugin. I need to make sure that the car does not accept its server position, but only sends it to the server so that other clients see changes in the position of the car. I want to do this, because with large lags, the player’s car moves with a very large delay.

In other words, I need to make sure that the server does not update the position of the player’s car that drives this vehicle.

I’m already working on your plugin’s source code, but I need help. What property do I need to edit to make this exception?

i wouldn’t call that fixing, what you want to do is called client authoritative model.

make sure your local vehicle’s physics body is simulated and do not call UFGearReplication::updateInterpolation function for this vehicle. This way you have authority over your transform and others will only see your interpolated position. This is a much simpler model but you might see problems with collisions.

I did what you said. The client now moves freely independently of the server, but because of this, the car starts to behave incorrectly for other clients. It drives normally at first, but then flies off in the other direction. Do you have any ideas how this can be fixed?

P.S sorry for my english :slight_smile:

i can’t tell you how to do it step by step since i haven’t done it myself before. the good news is you don’t need to write a lot of code but you need to list your rules and apply it to the current structure. i suggest first you understand how it works and then modify it to let the current player have direct control over its vehicle.

@lazybitgames Hi, do you think that you will made the plugin for UE5 or you will recommend me rather to convert cars to common UE5 system?

In order to do code changes, you have to understand that the physics in UE4/UE4 isnot deterministic…

Deterministic physics simply means that object being pushed (being applied force) will end in the same spot in many many tries. Here, UE4 is using PhysX and it is not deterministic. That is why you see the car doesn’t move in the same exact direction across the clients.

Btw, this is not an easy subject to tackle.

if you think epic will fix chaos problems for the next update you can use fgear, otherwise most of the same problems also apply to the unreal’s own vehicle system. i’ve already been testing fgear with ue5 and fixed most of the problems with some workarounds but not all of them, so we are also waiting…

1 Like

Really appreciate your work Yunus, I dread to think the amount of fixes you have had to action and indeed further issues you have/will come across. Fingers crossed all will be well and Epic will also do their part.

Looking forward to the final UE5 Fgear

To be honest, my programming skill is not high, so it’s hard for me to fully understand your code to do this. Can I ask you to do this and send the code to the mail please when you have free time? It’s not urgent, of course. But you will help me a lot if you agree to help. Thanks a lot!

My mail - nichirivero@gmail.com