I was feeling something wrong with the braking and started to debug.
I tried to disable/set 0 anything that affect to brake/torque reduction:
ABS: 0
BrakeTorque on each wheel: 0
DiffStrenght: 0
Rolling Resistance: 0
Aerodynamics: 0 on everything
— Disabled On FGearWheel —
//apply brake torque
mSpeedOverflow
And still, on press braking, it reduces the torque in some way.
It seems the problem is when Accel and brake is pressed.
Without accel, if i press brake, nothing changes in car behaviour.
But with accel pressed, if press brake, even with all that disabled/0, the torque decreases.
What im missing?
Edit: I think i found the problem:
In 1.81 & 1.7. there is “* mRadius” then this problems happens.
mFeedbackTorque = (FMath::Abs(currentForce) + absLngFriction) * mRadius;
In 1.62. There is a very minimal change, torque/lngforce less erratic, but no torque decrease.
mFeedbackTorque = FMath::Abs(mWheelTorque) + absLngFriction; // 1.62
@lazybitgames I am working on a vehicle pool system for my open world game. When using fgear vehicles, the physics body is always ticking even when “asleep” so I get an error “attempting to move a simulating body” when trying to pool a vehicle at 0,0,0. I have tried manually putting the body to sleep, disabling tick, disabling gravity but when those are reenabled, the vehicle body it not at its default suspension position. It works fine with chaos vehicles but I am having a difficult time with fgear vehicles. Any recommendations on how to achieve the above?
the vehicle body is not at its default suspension position.
so if I understand you correctly, you mean when you spawn a vehicle from the pool, it falls or jumps a little instead of just spawning at its resting suspension position. if that’s the case I guess I would implement a function that runs at the first frame only and adjusts the suspension so that it prevents this behavior. instead of that may be you can try running the vehicle.substepTick function once just after the spawn so that the suspensions are adjusted automatically, this should work in theory. you just need to make sure you spawn the vehicle at the correct Z position so that it would be at its resting state.
@lazybitgames So, what about this braking bug? The formula is wrong or this is the intended behaviour? Ive been testing and feeling is better, mostly happens on 1st gear/low speed.
To be clear is on FGearWheel.cpp on this:
// Automatically avoids low speed jitters
I also changed “if (mBraking > 0.0f)” to (aBraking > 0.0f) , aBraking is:
mVehicle->getStandardInput()->getBrakeFinalInput();
Using custom inputs (FGear Standard Input Disabled)
Using sequential or manual gear change, (Transmission > Auto Change Disabled)
When changing from first gear to reverse or from reverse to first gear with the throttle still pressed, the brakes get stuck (brakes activated automatically by the plugin), you have to press the brake once to release it. This problem is very annoying when you need to change gears quickly and drive off, but the vehicle remains stopped because the brakes were involuntarily activated.
Note: If you are using pedals on a combined axis, the brake is released as soon as you release the throttle, if you are using separate axes, you need to press and release the brake once to unlock it.
first of all it is recommended to use standard input even if you want to implement your own custom input system, without it replicating inputs won’t be possible.
in your case did you try setting “Reverse Brake Speed” to zero.
@lazybitgames jusy following up on this. Also is there an implementation on Enhanced input in the FGear example? The documentation is unclear on how to implement.
Okay, setting “Reverse Brake Speed” to zero solved the problem, although the car would rear up when shifting from reverse to first gear, but I’m going to limit the speed at which the gear can be engaged and add a gear scraping sound which should solve this problem.
Unfortunately I couldn’t use the plugin’s input system, I had to leave all the inputs manually to better integrate with SimpleController, the entire off-roading system and all the other peculiarities of my game.
the documentation clearly tells how to use enhanced input, look for CoreModule->Standard Input Settings->Enhanced Input System section.
the red car(Sedan_BP) in the sample project is fully setup for enhanced input, you just need to activate enhanced input from the engine settings and set input type to “Enhanced” in standard input component. There is a sub-category called “EnhancedInput” at the bottom of standard input settings, you might have missed that.
Their value is at zero, I believe it is just because of the excessive amount of torque and the sudden reversal of rotation in the wheels. But allowing the gear change only at low speed and implementing the solution for the brake lock, has already solved the main problem completely. Thank you.
@lazybitgames I dont know if there is plan to add this feature in next updates but,
What should be the best way to mimic the loss traction on braking/accel variations?
What im thinking is:
Get the difference between last brake/accel value and compare to actual.
Guess with some lerp to tell the amount of time to get the optimun friction again.
Then use that value to substract/multiply, maybe with some clamp to tell a max loss, from:
SlipRatio/SlipAngle, LatScale/LngScale or LatFriction/LngFriction ¿?
“In drifting, pressing the accelerator repeatedly at different pressures is a common practice known as “feathering” or “throttle control.” The goal is to balance the car between sliding and maintaining speed, and this requires fine control of the throttle to maintain the drift.”
Basically reduce the wheels friction on brake/accel variations for drifting.
Here you can see how Ken Block press repeteadly the accel, which gives some slide/loss friction to drift.
Thats what i want to achieve. Because now on fast accel variations i get some “fast impulses” due there is too much traction. Reducing friction overall will cause the car slide too much in standard circunstances. With this i can have good traction and get some drifitng using this technique.
Here is an example on an actual game, Need For Speed Unbound . You can see how the revs goes up/down constantly due is changing the accel pressure fast to keep the drift.
This is what most FGear users are trying to achieve. I’ve played around with a lot of parameters but the car either loses speed and drops rpm or loses traction completely and spins out. I’d like to see Fgear’s implementation of that video @Davit_Masia@lazybitgames something akin to carx drifting.
100% its the entire speed loss which is the issue mainly, I think traction changes based on slip can be achieved but the bottle neck seems to be that speed loss, I’ve tried so many ways to get it to just rev up round cornering but nothing seems to work, be good to see some solution.