FGear Vehicle Physics (v1.4)

I couldn’t change the title of the thread since the forum system was updated. is it possible somehow?

hmm that camera issue has slipped, i’ll release a hot fix asap, to fix it update the line as:

float tilt = -mTarget->GetActorRotation().Euler().Y + mTiltAngle;

Also are all this warnings “normal”? Compiles fine without problem but there are lots related to drawtext in .cpp and others in .h, with some comments by compiler that code needs to be changed/updated and other stuff. Tried with FGearExample, switched to 5.7 version and placed the FGearPlugin in the project.

Also says my Visual compiler is not prefered but seems that just update VS to MSVC 14.44 or similar and not should be the problem.

they’re all deprecation warnings so not that important.

1 Like

@lazybitgames Hi, in the input options, if I disable “keyboard to wheel,” the steer sensitivity is activated, but it behaves horribly. If I leave it in keyboard mode, the handling is better. Even so, I’d like to increase the steer intensity. Is it possible to do this without disabling keyboard mode?

“steer speed curve” is used instead of “steer sensitivity” with keyboard & controller. adjust the curve to scale your inputs.

With “Steer Speed curve” you can change the speed on steering based on car speed. But maybe he refer to the sensivity on steering with the stick/keys as steering wheel. I have my own core change in standardInput.cpp, so based in how much you want steer it applies a % of the steer speed curve. This is ideal for cornering and small corrections to control how much of that steer speed curve want to apply.

Example:

At 5km/h the steer speed is like 1.2, if you move the stick even just a bit, it does so fast at 1.2. With that, it moves like 20-50% based in how much the currentsteer is, giving a nice smooth feeling.

@lazybitgames

Is this bug gonna be fixed in big update or still there? The suspension tire penetration.

Or penetrates the floor or the car fenders as the tooltip from that checkbox says.

If still the bug remains, any idea where is the problem or any workaround?

Even at 1000 update, and on/off the wheels still penetrates the ground.

there is no plan to fix it because I don’t know of a way to fix it. the only thing I can think of is to have simulated rims and implement some sort of soft wheels but that would create its own set of problems.

hard contact or suspension constraints are the options you have but they may not solve it for all cases.

the update rate doesn’t matter, that only affects the simulation not the suspension updates. even if you run 1000hz physics it could still happen at high speeds.

my advice is to hide it as much as possible if you can. if your fenders can hide it then disable “Suspension Tire Penetration”, if not it is best to let the tires penetrate. the collision shape can be helpful to avoid it.

Checking UFGearWheel::getWheelPosition() & UFGearWheel::suspensionUpdate,

Is possible due mCompressedLength, there is a lag between physics solver and kinematic?
So the physics move the car chassis but the compresion is not in sync?

Maybe the suspension compression needs to be computed in a different way?
Or add distance (hit.Distance) between springTOP-ground?

Also wonder if with wheels with collision + CCD & MACD may fix the problem.

Im doing some tests and at some point reduces a lot but makes the suspension too rigid/weird and loses that nice bouncing. Btw only editing UFGearWheel::getWheelPosition(), guess i will need to edit both but too complex.

I know you still working on the big update but will be great if you can give another try after that.

-

EDIT: Maybe in this case is not relevant, but what about move the suspension /wheel position calculation Post-Physics? In the same way is done on skidmarks to avoid that gap?

the only way I can think of to fix it %100 is moving the vehicle mesh independent from the physics body. so it means you have to visually fake it, the mesh will not follow the body and stop at the penetration limit. this could cause other issues if the vehicle is carrying other simulated objects but that’s a rare case. implementing such a solution might be more difficult then it sounds though.

Not a big fan of that solution due needs to fake the body, but saved to give a try too as last option, thanks!

Hello i like this physics but the collision its strange , When one crashes, it bounces in a strange way; they move very strangely, it affects gameplay quite a bit. Any suggestions on how to fix this?

It’s worse at higher speeds.

well that’s how the collisions are handled by the physics engine by default.
you can tune the properties of the physics materials, namely friction and restitution(try low friction & low restitution).
if you need a specific behavior your best option is to utilize contact modification and change the contact resolving behavior.

where its the “contact modification”? still i have issues when i modifed the friction and restitution

afaik it’s a C++ only feature.

find FFGearAsyncCallback class in FGearVehicle.h and modify it like this:

class FFGearAsyncCallback : public Chaos::TSimCallbackObject<Chaos::FSimCallbackNoInput, Chaos::FSimCallbackNoOutput, Chaos::ESimCallbackOptions::Presimulate | Chaos::ESimCallbackOptions::ContactModification>
{
public:
	void init(AFGearVehicle* v) { mVehicle = v; }

private:
	virtual void OnPreSimulate_Internal() override;
	virtual void OnContactModification_Internal(Chaos::FCollisionContactModifier& Modifications) override;
	AFGearVehicle* mVehicle;
};

finally implement OnContactModification_Internal in FGearVehicle.cpp

Okay, I’ve implemented the code in FGearVehicle.h. What do I do now? I’m lost.

how much are you familiar with C++?

the implementation goes to FGearVehicle.cpp, for example the following one disables all collisions:

void FFGearAsyncCallback::OnContactModification_Internal(Chaos::FCollisionContactModifier& Modifications)
{
	for (Chaos::FContactPairModifier& PairModifier : Modifications)
	{
		PairModifier.Disable();
	}
}

I’m not familiar with it; it would be very helpful if you made a tutorial about this. It’s to improve the physics and the hits

Im interested on that too, on some collisions car looks like paper/low mass.

And in my case restitution bounce is set to 0, etc… to avoid the car behaviour feel like a pinball.
Used in FGearCustomCollision and materials/objects, tried lots of variations, but still.

@lazybitgames Im doing some research, is all about this?:

Any other doc related that we should know for that?

Also it seems there are problems with CCD no idea if already fixed in 5.7.1:

I guess some new options in the PM for contact modifications will be great to test.

this is an advanced topic that I also haven’t tried to get a good sense of collision. and as you said there’re some issues with the engine itself too. I don’t think you would find much documentation about it , the best option would be to go with trial and error.