FGear Vehicle Physics (v1.4)

@lazybitgames Speaking on the small vibrations. Is there any way physics or tick could be disabled when vehicle actors are far away from the player? Currently, I am activating collision in static mesh wheels to keep the vehicles from sinking into the ground but I haven’t seen anything in the plug-in to do this.

there is no such built-in feature.

Hello @lazybitgames , is there a way to make the vehicle come to a complete stop? , when I do a respawn it moves a bit, that is, is there a way for it to be with a permanent handbrake until I decide that it can move? what function should i use?

Check in fgear functions for Start Grid Mode, there are several ways you can do this also as you state via handbrake etc. Also you can disable engine and set brakes on in a few ways.

1 Like

In addition to what @PerfsPC said. The customization map has a function where the handbrake is activated when you navigate the ui. But off the engine node there is a Boolean to set running. You can set the handbrake and engine nodes off the unpossesed event.

1 Like

Maybe im missing something, but, if you use AutoChange but disable AutoReverse, when car stops, how you trigger reverse then?

Because shifter Sequential and Manual are disabled with “AutoChange” enabled. ¿?

So trying to get this brake/reverse behaviour:

1.- If you press brake with more than 0 speed or car in motion it will decrease until 0 and will stop the car.

2.- Only if you press brake when the car speed is at 0 & motion 0 = activate reverse.

Now with autoReverse if you are in a corner or do a 180º and get some 0 or negative speed value, if you press brake it activates reverse when you really want to continue braking.

Im looking in FGearTransmission & FGearStandardInput.

Tried some stuff but nothing is working as wanted.

The problem is how to detect the braking is pressed after car is stopped and not already pressed.

Or maybe enable sequential gear if autoreverse is off, so you can set just the R. On accel then it goes to autochange again ¿?.

EDIT: Im trying to enable sequential working with Autochange to enable reverse with AutoReverse disabled. Gears works always that are in gear ratio donw/up but it not changes always that is pressed like without autochange but can figure how.

Well, i got something working.

	// ADDED ***********************
	// Using Sequential to set R in AutoChange mode without AutoReverse
	
	if (mShifterType == FGearShifterType::SEQUENTIAL)
	{
		// Set R
		if (mGearboxInput < 0) mVehicle->getTransmission()->gearDown(true);

		//invertVertical	
		if (mVehicle->getTransmission()->getCurGear() < 0)
		{
		float tmp = mEngineInput;
		mEngineInput = mBrakeInput;
		mBrakeInput = tmp;
		}
	}
    // ADDED ********************************************

Now i can have AutoChange and set reverse when needed.

The optimal thing will be set autoreverse only when the car have some X angle+negative speed values / motion. To avoid autoreverse in the scenarios mentioned like 180º corners,etc… but still allow when you want to do a 360º or similar.

This sounds really useful, thanks @Davit_Masia - Will also test this out.

In FGearStandardInput.cpp , search for “bool invertVertical”

	// ADDED ****************
	//invert engine/brake inputs in reverse(auto)

	// Added "getSteerDeltaAngle" to use only on wanted situations

	bool invertVertical = mVehicle->getTransmission()->isAutoChange()   &&
						  mVehicle->getTransmission()->isAutoReverse()  &&
						  mVehicle->getTransmission()->getCurGear() < 0 &&
						  FMath::Abs(mVehicle->getSteerDeltaAngle(true)) > 89.99f ;
						  
	// ************************************

Still testing but seems this can fix some of that issue. Trying to find the correct getValue. At least the problem not happens as much as before.

Which cpp was this? FGearTransmission.cpp?

Both FGearStandardInput.cpp . On transmission im trying some stuff too but at the moment no changes were made there, just tests that are all disabled.

2 Likes

Ah ok

CHANGELOG v1.6.2
Unreal5.2 support
Improvements and bug fixes

Warning:
-To use the example project with Unreal5 copy the FGearPlugin folder in Unreal5\Engine\Plugins to FGearExample\Plugins folder.

Additional Notes:
-Ensure fails are eliminated for non-substep mode.
-Overall refactor to use physics transform instead of actor transform for vehicle calculations.
This fixes some hidden issues and makes the plugin more stable in Unreal5.
-A landscape is added to sandbox map.
-Added an option to override CollisionTrace for custom collision in order to fix Unreal5 issues.
-Fixed a minor issue with the Constraint map.
-Engine power calculation wasn’t taking friction torque into account, this is fixed now.
-Added ability to set bone name of wheels.
-Convex casting meshes no longer generate overlap events with the world.
-Wheel.setRadius function is updated to work with convex casting.
-Convex casting options are extended and moved to vehicle class.
-A custom cylinder mesh asset is included in the plugin folder which works fine against the landscape in Unreal5.
-Cleared all deprecated warnings.

4 Likes

Top work as always, thank you for the update, will check this out soon as I can.

I thought we had this anyway? or am I missing something.

you might have added it yourself…


Are we referring to this? for each wheel as that’s been there for years :), must be something else I’m not aware of?

Im interested about this:

-Engine power calculation wasn’t taking friction torque into account, this is fixed now.

To confirm, the added/edited was in FgearEngine.cpp, with this?

float friction = (rpm / mLimitRpm) * mFrictionTorque;|
float torque = mTorqueScale * (mTorqueCurve->GetFloatValue(rpm) - friction);|

Or there is any other line added/edited about this fixed issue? Want to test one and other to check the driving difference.

it doesn’t effect the simulation, just the displayed power text.

@PerfsPC added a new function to update at runtime

2 Likes

This is awesome. Thanks for the support and the ability to set bone names!