Is it possible to change a vehicles properties at runtime? Any changes I make to VehicleMovement (UWheeledVehicleMovementComponent) do not take effect until the vehicle has respawned.
I need to be able to change the vehicles physics on the fly but I cannot figure out a way to do so.
To change vehicle properties you can try to create class derived from UWheeledVehicleMovementComponent4W, then create some function and set up options you want (Mass, MaxEngineRPM, etc) and call SetupVehicle(). To find example how to create your own VehicleMovementComponent check VehicleGame example (UVehicleMovementComponentBoosted4w.h/cpp).
Thanks for the suggestions, but I don’t think this solution can be valid for OP’s situation/example. For example, Wheels is immediately overwritten by the WheelSetups in SetupVehicle(). Modifications made to Wheels[0] will not affect the simulation.
Further, the recreation of the physics asset causes a loss of information - the vehicle velocity is reset, for example. This doesn’t really fulfill the criteria of ‘on the fly’.
I haven’t had any luck with calling SetupVehicle(), as I appear to lose the ability to control the vehicle afterward (user inputs not updated). I had more luck calling RecreatePhysicsState(), as I could drive the vehicle afterward, but the reset on velocity still applied.