FGear Vehicle Physics (v1.4)

I know, was refering in my end, actually have a “getSteerDeltaAngle2” just cloned for this case. But yeah will keep separated atm until do all tests and double check im not using any assists or similar that can cause any interference.

Btw, what about lock wheels rotation when holding braking? Not should they got locked when reach 0 and not move forward-backward?

brakes can make the wheels come to a stop if there is enough brake torque, the tire friction force can overcome the brakes in certain cases and make the wheels rotate. it shouldn’t happen with strong brakes and/or slippery surface.

1 Like

Hello, just one question since I am interested in buying your amazing system. I tested the demo a bit and I noticed that somehow the vehicle’s will try to recover to the correct position, no matter what. For instance, testing the bike, I noticed that it will always try to recover to have the wheels down to the ground, same for the cars.

Is this something that can be configured/disabled/avoided?

For my needs, I want the vehicles to be able to flip and also this “recovering” they are trying to do, doesn’t seem to natural, no offense :slight_smile:

Thanks in advance.

hi, you can’t flip the bike yes but it’s not the case for cars. we apply an external force to keep the bike up and it can interfere with the overall motion. cars on the other hand should easily flip but most of the time we keep the center of gravity close to ground which makes it difficult to flip. that’s intended behavior and can be changed. can’t say the same for the bike though, bike assist is a demonstration and you’re encouraged to roll your own solution if the bikes are an important part of your project.

Hello! Is there any plan to add linux as a target platform? im interested in making a steam deck native build of my project.

short answer is no but don’t forget that when you have the source code you can build on any platform.

Hello,

I’m currently trying to add force feedback effects to a vehicle, such as different vibration effects on the controller when the vehicle collides with something or drives over a bumpy road (similar to the speed bumps in SandBox.map).

My idea is to monitor some key data of the vehicle in the “Tick()" function to determine its state and further decide whether to play the ForceFeedbackEffect. However, I’m not sure which data I should obtain to determine if the vehicle has collided or is driving over a bumpy road. Do you have any suggestions?

Additionally, I’ve tried adding a Box for overlap detection on the road to achieve the effect I want, but I feel like this approach might be too cumbersome.

And handbrake not should block rear wheels always?, even with max 100 handbrake power, and using 6000 braketorque on rear wheel if you have accel pressed the rear wheels not stop and they should.

So i have to do this ( Added a bit of lerp to avoid sudden stucks)

if ( mHanbrakeInput && aRearWheels ) { 		 	          
mAxle->setTorqueShare(FMath::Lerp(mAxle->getTorqueShare(), 0.0f, 0.08f));}
else mAxle->setTorqueShare(FMath::Lerp(mAxle->getTorqueShare(), aTorqueShare, 0.2f));

Or maybe “handbrake power” is another thing to be deprecated and i should avoid it?

handbrake power does not effect the brake torque but it scales the rotational acceleration of the wheel. if you’re pressing the throttle then it can eliminate some of the brake power and when combined with the tire friction it might still rotate. “handbrake power” can be used in an arcade setup but ideally it shouldn’t exist in a proper simulation.

hi, for collision events I would stick to regular physics hit events and maybe do some filtering. getting the impact velocity/normal should give some information about the feedback scale.
about bumps it could be handled in a couple of ways but hard to tell which would work best. I would probably try to get each wheels local Z velocity and consider it a bump when it reaches a certain threshold. you could check wheel.getRayHit or wheel.getSuspensionCompressedLength etc. to calculate the vertical velocity. make sure you add some averaging to filter noisy data.

@lazybitgames I may found a bug with Clutch.

in UFGearEngine::setFeedback you use:
float clutchPower = mTransmission->getClutchState();
if i understood well, thats just 0 to 1?, clutch power not should be like this?:
float clutchPower = mVehicle->getTransmission()->getClutchScale();

Seems clutchstate is always in 1 and only goes to 0 when gear changes.

In UFGearWheel::applyRpmLimit you set:
float clutch = mVehicle->getTransmission()->getClutchState();
In this case guess is correct? so limit goes t 0 to 1 apply to be able to change.

Also in UFGearTransmission::updateClutchState, mClutchScale is clamped to 0-100:
mClutchScale = FMath::Clamp(mClutchScale, 0.0f, 100.0f);

But in The BP, slider is 1-1000, so means it really only will affect until 100?

Can you double check please?

Im trying to implement “Clutch Kicking”:

I tried changing by Scale, via button for “Clutch Kick” but the difference between 0 and 100 (or 1000) not seems to give the same effect.

So maybe is my car setup or the clutch/rpm how is done are not working as expected, no idea, so let me know, maybe i should use another workaround for same effect?

@lazybitgames , would it be possible to make the white wireframe wheel in Debug adjust to the forward offset (as it already does with the Rim offset)? I’m fine-tuning the wheel offset relative to the kingpin rotation with the UFGearWheel.setLateralOffsets function, but it’s harder without visual feedback.

you just misinterpret what clutch state and clutch scale are. the real clutch value is clutch state, clutch scale is an artificial value that should be rarely used like in the clutch assist case. there is no bug there.

with a steering wheel and pedals clutch kicking should work naturally. if you want to trigger a clutch kick in a realistic manner then you should be altering the clutch state not clutch scale.

if you want to observe what clutch scale does you should use a smaller number like 0.2. 1.0 or more might behave the same in most cases. reducing the clutch scale might also behave similar to a clutch kick, it would let the engine revup without getting slowed down by the wheel speed.

2 Likes

yes, it looks I have forgotten to apply other offsets to the debug view. adding this to the todo list.

Thanks!

@lazybitgames In the same way is possible get the RPM of different axles, is possible get the “mLngFrictionForce” for each axle? or the friction of each axle?

Using the TorqueSplitter as Center L-S-D works fine as real ones due they are based on RPM differences, les RPM usually means they have more friction so more torque is sent to that axle, but there are some exceptions where the torque is sent to the wrong axle like in real life. In that cases driver skills can manage that, but due here we have access to friction values, better using that for 100% accuraccy, but no idea if possible and how. ¿?

we use feedback torque for differential calculations.
for each axle you can call axle.getFeedbackTorque()

I was thinking in some way to get “mLngFrictionForce + mLatFrictionForce” of each axle, to get the total friction, then send more torque to the one with more to mimic what a Center L-S-D should do.

Will try then with FeedBackTorque to see how it does.