it’s not just about spinning direction, that function assumes the vehicle going forward, you should detect the case when the vehicle’s velocity is not aligned with the vehicles forward direction(you can use a dot product) and possibly invert the forward vector.
I tried, better but still fails. I found adding this one to the condition helps:
float rollZ = FGearUtility::getWorldTransform(mBody).Rotator().Roll;
But still fails in a few frames, enough to make the car get stuck.
There is no other Rotation variable that already gives always the correct values? I tried mLocalVelocity.Y and other lateral stuff but all them fails in one or other scenario.
well you may not be able to get a result that works right away, find the failing spots and make adjustments as needed. you just need to debug the code to see what numbers are failing.
How i get LateralFriction or LateralScale,etc… per axle?
Only get working this:
mAxle->getWheelOptions()->getLateralFriction();
mAxle->getWheelOptions()->getLongitudinalFriction();
Or if they are axle*wheel:
mVehicle->getAxle(0)->getLeftWheel()->getLateralSlip();
But when the get/set is only available for axle, im unable to find how ¿?
But via code, tried FrontWheelOptions, or WheelOptions0 or similar but nothing worked. Checked other .cpp but cant find any reference how i should do that. ¿?.
wheel options are per axle, shared between wheels.
after doing any modification, you should call Axle.applyWheelOptions function.
wheels also store local values too but they can’t be read from BP right now, you can only modify them per wheel like Wheel.setLatFriction, if you want to access them per wheel you need to add your own BlueprintCallable getter functions.