FGear Vehicle Physics (v1.4)

This is not FGear issue but rather, UE4 bug. It manifest itself in condition like this:

  • Blueprint is created inheriting FGear C++ class.
  • Then I update the FGear to latest version
  • The BP then strangely, somehow get corrupted (not all) and the only clean way that I can think of is to recreate the BP from fresh.

Hello again! The FGear orbit camera seems to have some fisheye effect or similar, which increae the “speed feeling” quite well. Can you point me to the place where these settings come from to tune it? In the Orbit Camera C++ class itself it seems it is just calculating the positioning, but I do not see the (post process?) effects creating that point of view. Thanks a lot!

we do not alter camera fov at all, epic has changed some camera settings in 5.3 maybe that’s what you are talking about, check this one : Camera FOV is incorrect in Play mode UE5.3

Okay, thanks, that is still weird but a good hint.

I have another issue which came up today. I tried adding a CollisionResponse to my car. I add it via CustomCollision = CreateDefaultSubobject(TEXT(“CustomCollision”)); then set it via CustomCollision->SetStaticMesh(ItemCollision.Object); Seems to work, I can see it in the game as a member of my car, having the static mesh set. Then I disabled the CollisionResponse in the physical Asset we used until now. Still working. But if I drive now, I can collide with objects as guard rails, but will ghost through other cars, which do NOT use UFGearCustomCollision but a “normal” physical asset. No flags set, all default. Any ideas? These other cars are working like they should, just not when colliding with “the other way of doing it”. This is really confusing me here! Thanks a lot! In addition in the docs for the truck there is this image, which shows the used collision box on it, but layed over the mesh, not the collision mesh. How can I see this? It would help debug for sure.
grafik

I recommend you to add your custom collider at design time and try applying the same/similar settings in the sample project. if you check the sample project you can see those wireframe like visuals, the custom collider has a special material that displays it like that.

Any estimation for UE 5.4 support? It will include any update?

the next version is planned to be released next week.

Any physics/driving improvement/fix/addition?

some minor stuff, the update is mostly not about the physics.

here is the updated multiplayer demo with up to date physics and the new client authoritative replication(built with UE 5.4)

3 Likes

Sometimes the skidding (sound and mark) and smoke effects are activated at very low speed, would it be possible to set a minimum speed for these effects to start working?

ps: I mean wheel speed, not car speed, these effects are good in case of a burnout.

And where is the link for the example project with that new cars on the Fgear marketplace page? The link on description is the old example from 4.27. Âż?

Nevermind, they are in a new Sandbox2 level i just saw.

v1.8 is now available

  • Unreal5.4 support
  • Client authoritative replication
  • Enhanced input support
  • Rev-matching for manual transmission
  • Replicated sleeping
  • Forward offset option for wheels

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

Notes

  • Checkout CoreModule.pdf document for a more detailed explanation of the new replication options.
  • In client authoritative mode all the vehicles are simulating physics and the control over your vehicle is just like a standalone game. While the input replication is quite similar to the server authoritative mode, state replication is quite different. It is a combination of a network correction and temporary physics blending after collisions. We tried to handle collisions gracefully but you can still encounter bad collision reactions with bad network conditions.
  • Client authoritative replication can blend replication transform with the physics transform. For this to happen we listen to the NotifyHit callbacks in the vehicle class and trigger the blend if the conditions are met. If the collision profiles of the vehicles are not properly setup then this blend may not be triggered at all and it’s difficult tell whether if it’s working or not. In order to diagnose such issues we introduced a new telemetry option called “Print Collision Logs”. When this is on you should see a log printed whenever two vehicles collide at a speed greater then MinCollisionBlendingSpeed. If you do not see the logs you can tell that there is a problem with the collision(hit event) setups. This log is only printed with the client authoritative replication mode.
  • Existing server authoritative replication is still available but it is off by default. It can be turned back on via setttings in ProjectSettings > Game > FGearCommon.
  • Each vehicle had its own replication settings and we had the option to override and use common settings(ProjectSettings > Game > FGearCommon). From now on we use the common settings by default and each vehicle can override the settings if needed.
  • Removed buffered input replication. This prevents any input delay due to server slowdowns.
  • Reduced default input send rate from 50 to 20 same as state send rate.
  • Input and state replication variables are now compressed/quantized for reducing bandwidth costs.
  • Input and state replications are no longer optional but you can set zero send rate for each to pause the RPCs.
  • Added an AI driver following a spline loop in the Multiplayer map.
  • Auto drive is no longer a component but an AIController. Instead of adding as a component you need to possess the vehicle with this controller. The controller won’t function with its default form so it’s better to derive from it and create a BP(there is a sample bp called FGearAutoDrive_BP in the sample project). Spawn the controller(you can both manually spawn or let the engine spawn it), tune it’s settings, provide a spline to follow(FGearAutoDrive_BP looks for the first spline in the map and assigns it at beginplay) and finally possess the vehicle. This is exemplified in the AITest map.
  • Auto drive inputs were applied directly to the vehicle components before but now the inputs are applied via the standard input component. This made it possible to use it with both server & client authoritative replication modes.
  • Auto drive is no longer ticking by its own but it is updated by the onOverrideInput delegate which is explained below. This let’s the AI inputs to be replicated properly.
  • Removed overrideInputTick native event and added onOverrideInput delegate instead. This delegate is either called in the actor tick or the replication tick so we can also override inputs in multiplayer.
  • Mobile input sample now uses the onOverrideInput delegate to inject UI inputs.
  • Replication component used to override input-reading option of standard input. This is no longer needed and is not mandatory for input overriding.
  • Checkout CoreModule.pdf document(StandardInput settings) for a more detailed explanation of how you can activate and use enhanced input system.
  • We have added some basic enhanced input assets under FGearAssets/Inputs folder in the sample project.
  • Raw input values can be accessed via BP now. This lets you keep current player inputs and modify/alter some of them.
  • Open differential implementation used to check the wheel rotation speeds but it is only based on wheel load right now which is better at imitating an open diff.
  • Torque bias ratio was unlimited for locking diff calculation, it is limited to 9:1 now.
  • Manual transmission rev-matching is only for downshifting.
  • A sleeping vehicle couldn’t wake up in a multiplayer game, this is fixed now.
  • Users can now query the visual location and rotation of each wheels with UFGearWheel.getWheelPosition and UFGearWheel. getWheelRotation functions.
  • Forward offset of a wheel can be updated at runtime with UFGearWheel. setLateralOffsets function.
  • Added a separate option to mute the engine sound when the vehicles goes to sleep.
  • Added a config line(AspectRatioAxisConstraint) to the DefaultEngine.ini which prevents the camera fov change that started happening after 5.3.
  • Fixed a crash case which happens when you put a vehicle in a sublevel and stream out in unreal5.
5 Likes

Great work as always @lazybitgames will check this out.

2 Likes

Is there a way to unbrick my project after updating?
Screenshot 2024-05-15 214309

Thank you for implementing “Forward offset” and the option to keep the engine sound when the vehicle sleeps!

The plugin is compiling without problems for UE4, however it is necessary to enable the “Enhanced Input plugin”, otherwise the plugin presents an error and does not load. The “Enhanced Input plugin” is in Beta and does not have full functionality in UE4, I hope there is no risk of any conflict or loss of performance due to the plugin being loaded.

Still about the effects:

When the vehicle sleeps, the smoke particles disappear suddenly, I looked at the code and you are using “mSmokes[i]->SetVisibility(true / false)”, I am not a C++ programmer, I would like to know if it is safe for me to change it to: “mSmokes[i]->Activate() / Deactivate()”, this way the smoke would appear/disappear smoothly and the visibility would change anyway (in addition to the fact that an inactive emitter consumes less resources than an invisible one).

Activating and deactivating the tire smoke at runtime is essential for my project, since the “mEnableTireSmoke” variable already exists and using “setEnableSkidmarks” as an example, if I create the following lines in FGearEffects.h, it would be possible to activate/deactivate the smoke safely at runtime?
UFUNCTION(BlueprintCallable, Category = FGear)
void setEnableTireSmoke(bool e) { mEnableTireSmoke = e; }
UFUNCTION(BlueprintCallable, Category = FGear)
bool getEnableTireSmoke() const { return mEnableTireSmoke; }

I would like to ask you to reconsider your position regarding improvements to the effects system, it is something that enriches the plugin and was one of the reasons that made me decide to purchase it. My suggestion would be:
Checkboxes to enable and disable engine sound and backfire.
A variable to determine when the wheel effects will start, “minSlipFXVelocity”.
Two runtime functions: “enable/disable smoke” and “enable/disable backfire”.
Good but not essential: “FadeOut” instead of “Stop” on sounds.
This would be more than enough to make the implementation of the effects much more viable, because at the moment it’s more like “use all or nothing”…

Thanks

Destroyed function is removed in v1.8, using EndPlay instead, replace it and it should work.

it is safe to call activate/deactivate but the effect can be reactivated after sleeping.

I guess it is also safe if you add those functions to enable/disable smoke at runtime(you need to recompile the plugin or use the plugin source as a part of your project or just adding those lines will not make them appear in BP).

effects component was never intended to be used for production, we do some improvements from time to time but a generic implementation can not fit everyone’s needs, so no promises.

I always need to recompile my plugins with RunUAT to run on UE4 Source.

I would then need a condition to prevent the smoke from activating when the vehicle is sleeping, and if I add “!= mSleepEventsRegistered” in the function below, would it work?
If so, which “if” structure should I put it in? (if you could please rewrite the condition, to avoid mistakes on my part, I am completely new to C++)

//smokes
if (mEnableTireSmoke && cs && physicalMaterial->mSmokeParticle != nullptr)
{
if (mSmokes[i]->Template == nullptr || mSmokes[i]->Template != physicalMaterial->mSmokeParticle)
mSmokes[i]->SetTemplate(physicalMaterial->mSmokeParticle);
mSmokes[i]->Activate();
mSmokes[i]->SetWorldLocation(hit.ImpactPoint);
}
else
{
mSmokes[i]->Deactivate();
}

ps: Thinking better, instead of changing the visibility or activating, changing “mEnableTireSmoke” to false/true would be easier, right?

Where would I replace it? I can’t open the project at all.