FGear Vehicle Physics (v1.4)

Hi.. just realized that FGear remote car’s wheel does’t rotate. The server (which does all the physics) rotates ok.
Any pointers where should I look for fixes?
I tried looking at FGearReplication.cpp which I think is where all the replications happened, but the wheelanimation is updated only inside FGearVehicle::tick using UFGearWheel::visualUpdate.

So it maybe that some variables get wrongly assigned or calculated (I have a heavily modified FGear) ands when they get passed to visualUpdate, it doesnt move. So I am looking for suggestions of where to look for to fix the code.

Thanks.

@lazybitgames In the same way we have “Forward Offset” in axles, that changes the X in local position, will be possible add the same but for Z offset?

Actually im doing this that works fine, but better have all in the BP for better setup.

Is to get all cars same setup with wheels position without mess with suspension/preload for each one which can change the driving too.

it seems good to me in the sample project, both with server and client authoritative modes.

we only replicate inputs + vehicle transform and expect the the other components to update locally.

yes, instead of having separate forward/lateral offset etc. we could have an offset vector that transforms in all directions.

1 Like

Is FGearCustomCollision working as it should? Or is something to avoid that will be deprecated into the future?

I import a mesh for a collider but it always use a simple collision one which looks like an obelisk.

I checked the option “trace complex on move”, but still uses the simple collision. ¿?

FGearCustomCollision is not a mandatory class which means you could achieve the same thing by adding a static mesh component and configuring it properly. FGearCustomCollision enforces some settings and assigns a wireframe material by default.

make sure you use “UseSimpleAsComplex” option in your mesh settings.
“trace complex on move” has nothing to do with this.

1 Like

Hi, I am having trouble with managing tire options parameters at runtime. For example, these two functions do work only with beginplay, but what I need is to update these values at runtime using Async tick. Other components functions do work this way, but not in the case of tire functions.

there is an extra step needed for wheel options, you need to call Axle.applyWheelOptions after modifying a variable.

here is a screenshot from the modification sample:

It worked, thanks!

sorry only independent suspensions are supported.

1 Like

Hi FGear Dev! Question: When I Un-possess a vehicle with the Non-Server Authoritative mode, then the vehicle is teleported to 0,0,0 and I can’t seem to do anything about it.

Do you know of a solution here or am I forces to use server authoritative to prevent it?

I’m on UE 5.5 and your latest version of FGear

Update: I can get it to not teleport if I possess the vehicle with a temp AI controller then moment after I possess my character pawn

thanks for the feedback, I have confirmed the issue and it’ll be fixed in the next update.

in the mean time you can use that workaround, it seems harmless.

1 Like

Been quiet in here lately. Anyone tried to compile the plugin for 5.6? Got a couple of warnings about deprecated stuff and one error. Hopefully official support is coming soon. Also looking forward to the next product from the devs will be.

1 Like

@lazybitgames any ETA on 5.6 support?

this month or next month at the latest…

3 Likes

an update on this issue.

with client authoritative mode the local player has the authority over the vehicle transform but when you unpossess the vehicle there is no way to tell others about your transform so the server must take over just like AI controlled vehicles. in short your workaround seems like a valid solution, i’ll only prevent the teleport to zero origin just in case the developer fails to handle the case.

v1.8.3 is now available

  • Unreal 5.6 support
  • Hill-holder assist
  • Vertical offset option for wheels
  • Improvements and bug fixes

Notes

  • Hillholder does not work like in real cars, you do not need to brake in order to initiate the hold. When you come to a stop on a hill the vehicle will brake on it’s own before it starts rolling back. The side effect is that it also engages when you come to a stop on a flat surface but it’s harmless.
  • Renamed UFGearWheel.setLateralOffsets function to UFGearWheel.setWheelOffsets. You can use it to update all wheel offsets at runtime.
  • Fixed the issue where an unpossessed vehicle would be teleported to zero origin. While this behavior is fixed developers should make sure a vehicle is never unposssed in multiplayer. A pawn without a controller can not send it’s data to the server.
  • A new event is fired from the engine component called OnStartStop which explains itself.
  • A new option called “Query Response Overrides” is added to the tracing options. With this you can create exceptions for the query responses of line and sphere queries(not supported with convex casting). This is equivalent of the FCollisionResponseParams option in C++.
  • An empty physics asset won’t crash the engine anymore.
  • Removed “Allow Wheel Rotation Against Engine” option.
  • Dropped 5.3 support.

Warning: If you have difficulty running the example project with Unreal5 copy the FGearPlugin folder in Unreal5\Engine\Plugins to FGearExample\Plugins folder.

2 Likes

@lazybitgames
Thanks for the update, but I noticed a few issues:
(I’m using manual transmission with automatic clutch)

  1. Hill-holder assist:
  • If the car is stopped and I change gear (even to neutral), the car doesn’t start moving again. For example, if I was going uphill in first gear and I stop accelerating, if I put it in reverse, the brakes remain on.
  • Sometimes the car gets stuck when going downhill at low speeds.
  • Sometimes the vehicle gets stuck and only starts responding again when I press and release the brake.

I think it should work according to the speed, gear and slope (you can check if the vehicle’s rotation in Y is positive or negative to know if the car is going up or down), for example:
If I’m in first gear on a hill, I stop accelerating and the car reaches a certain negative speed, the system should be activated simulating the gear holding the car, but if I put it in neutral or in a gear in a favorable direction (Reverse on the uphill and any other gear on the downhill) the system should turn off and allow the vehicle to move. If the vehicle’s rotation is close to zero, the system should not be activated.
The “Allow Wheel Rotation Against Engine” seemed to work perfectly, why was it replaced?

  1. I think you forgot to update the debug wireframe to show the current position of the wheel offsets.

I’ve retried to change gears with a manual and it released the brake with a gear change(tried both forward & reverse). I think auto clutch has a problem, can you try those with a manual clutch.

I also didn’t encounter any stuck cases, if you consistently see those behavior please send your json files and describe how to recreate it.

“Allow Wheel Rotation Against Engine” was conflicting with another feature which caused a bug and it’s also not a realistic feature.

debug gizmos show the correct position, I was mistaken earlier, there is no problem with that. again if you think there is a problem please elaborate.

My problem with the debug wireframe is the following:
My rig has two bones for each wheel, one for the physical wheel and the other for the geometry. (I did it this way so I could animate the suspension and kingpin correctly)
When I apply the offsets (forward and spacer), the collision of the physical wheel goes to the correct place, but the debug wireframe does not follow it, but it works with the Rim offset.
My question is why the wireframe is not following the wheel collision, does the fact that the bone has no geometry influence anything?

I tested Hill-holder assist with the manual clutch and the problem persists. I am attaching the Json file.
JampFGearVehicle.json (8.1 KB)