FGear Vehicle Physics (v1.4)

yes both are negative in the book but that doesn’t mean they can’t be positive I guess.

btw I have mailed you a modified version of the tire model class that includes the clamps that I have mentioned.

@lazybitgames Hi, is there any way to make really slow speeds possible?

Something around <2 km/h

The torque is so strong that the vehicles are stuck or slowly jumping/jittering forward.

The only way I found which does not work with slopes is setting the torque scale to something like 0.01, which makes the vehicle have around 5-7hp

how would you do it in real life?
you would need to adjust the torque with the clutch or use the brakes.
having a lot of torque and being limited to a tiny speed might fail due to numerical errors.
I don’t think it’s possible out of the box, you need some sort of code that adjusts the torque to keep the vehicle at a certain speed.
as an example you can try the cruise control assist. add arcade assists component, activate cruise control and set target speed to 2 km/h and watch how it goes.

Increasing Drivetrain Friction in the Class Defaults (or was it Class Settings?) helped when I needed my tanks to have a lot of torque to run over and climb over stuff but still be slow as heck.

Hello @lazybitgames There is a map called “AITEST” I like it a lot, but I would like to make the cars start a race with a counter, also if it is possible to manipulate them to stop when you want, is that possible? I suppose so but I’m lost in it, if you could make a tutorial I would really appreciate it.

you can check the drag race map for an example to starting the race with a countdown.

when it comes to stopping an AI you can unpossess the vehicle and engage brakes manually or if you want the braking to be a part of the AI logic then you would need to modify the AI controller code.

Hi, I am playing with values a bit right now and found in UFGearStandardInput::filterInputs() the throttle range calculation:

float rangeFactor = 100.0f / mThrottleRange;
mThrottleInput = FMath::Abs(mThrottleValue) * rangeFactor;
mThrottleInput = FMath::Clamp(mThrottleInput, 0.0f, 1.0f);

Is this correct?

It look as if the rangeFactor will always be > 1 as mThrottleRange is clamped 10 - 100, which looks like an error to me. Together with the Clamp between 0 and 1 this code does only increase the throttle input faster if the mThrottleRange is lower than 100%.

The same is happening for braking, clutch and steering.

it is correct, you probably misunderstood what it’s used for.

for ex. if you set mThrottleRange to 50 then %50 or more throttle input will be %100 throttle.

in the mean time the throttle input is actually the output of mThrottleEngagement curve so it’s a bit more complicated, the above statement is only true when the default engagement curve is used.

ok, I did think “range” ist similar to a clamp in this context. as the throttle can only be pressed 50% if 50 is set as the range. to limit the input, but this could be set through the engagement curve as well.

Another question, no matter how much I do throttle, the engine rpm will always reach the max rpm value, I thought not throttling so much would hold the engine at lower rpm values?

that’s not necessarily true, it depends on engine setup.
for instance the red car(Sedan_BP) won’t reach limiter with %50 throttle.

Hello , i copy the code of the drag map and works well but , when the count down go to “1” the cars changed the location , Disconnecting the drag code makes the cars start correctly where they are.

find FGearAutoDrive_BP and set “Stuck Reset Time” to 10 seconds.

1 Like

Thanks, it works great. Another question: How can I control the speed of the AI? It’s to do a launch race, so it has a smooth speed and then the speed the AI ​​wants.

the AI controller is not meant to be that flexible, it is just a sample.

however you might be able to achieve that.

“Speed By Angle Curve” lets you limit the speed of the vehicle but you can’t change that at runtime unless you make a little bit of code change.

You could have 2 AI controllers one of which could have a low speed limit(rolling speed) and the other would be the regular controller. so you start with the limited controller and then swap to the regular one. give it a try…

Well, I’m just looking to reduce it or give it a maximum speed and then give it the free speed so they can drive like this on the test map.

ok, there are multiple ways to do that and I hinted one approach, did it work?

there are also alternatives like limiting speed via temporarily switching to manual gear and prevent gearing until the race starts.

or utilize the cruise control in arcade assists, you can see it in action in the modification.map of the example project.

Cruise control is great, but how could I activate it for all cars? And not do it for each one.

you can activate it for all cars by activating for each one.

Could you give me a sample of how to do it in an image?

activation/deactivation of cruise control is already exemplified in modification map.
just make sure input is not overriden by ai controller, ai input may or may not override cruise control based on execution order.