Hello, i need help to Set Vehicle Mass in realtime, the problem is that Inertia Tensor Scale increases with new Mass Value and does not reset back.
Question is How to set Inertia Tensor back after changing the vehicle mass?
cpp inherited from VehicleMovementComponent4W:
#include "SalkiGame.h"
#include "SalkiVehicleMovementComponent4W.h"
DEFINE_LOG_CATEGORY(SalkiVehicleMovementComponent4W_Log);
USalkiVehicleMovementComponent4W::USalkiVehicleMovementComponent4W(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
void USalkiVehicleMovementComponent4W::SetVehicleMass(float newMass, FVector newInertiaTensorScale)
{
Mass = newMass; //set new mass value
FixupSkeletalMesh(); //Not sure if it is doing something
SetupVehicleMass(); // Updates the VehiclePhysX with new Mass but Ruins Inertia Tensor Scale
InertiaTensorScale = newInertiaTensorScale; // Doing Nothing
//SetupVehicle(); // - Ruin all Vehicle PhysX
UpdateSimulation(World->GetDeltaSeconds());
UE_LOG(SalkiVehicleMovementComponent4W_Log, Warning, TEXT("InertiaTenzor = %f"), InertiaTensorScale.X);
}