C++ - Vehicle - Apply torque to wheel,

Hello everyone,

I’m trying to create a realistic vehicle and if possible without having to modify Unreal Engine. The default driving model in UE is bad in one thing and that’s the combined throttle/brake axis, namely the fact that even if apply 0.1 of braking, the vehicle goes on full brake and I haven’t found a work around this (other than modifying UE).

My second idea was to interact with PhysX (which handles throttle and brake separately) directly bypassing Vehicle Movement Component, but once again haven’t found a way to acess PhysX from game code.

My latest idea was to apply forces directly to wheels, which doesn’t work as well. But I’m not sure if i’m doing it the right way.

	owner->GetMesh()->GetBodyInstance("Wheel_Rear_Left")->AddTorque(FVector(300, 300, 300), true);
	owner->GetMesh()->GetBodyInstance("Wheel_Rear_Right")->AddTorque(FVector(300, 300, 300), true);

owner is Vehicle Pawn. I also tried to apply each axis separate, but still no efect. The wheels don’t spin even in the air. So if anyone can tell what I’m doing wrong, or any hint how to make my previous ideas work, would be greatly appreciated. I mean, 3 beers if I ever meet you in person :slight_smile:

Jan aka ENiKS,

You need a lot more torque power than 300.

Try going for 50000000.0f.

i’ve tried applying even more than that, even that 300 Nm should be enough to get car moving … Still, the car is not moving

GetMesh()->SetSimulatePhysics(true);

Don’t use GetBodyInstance();