Help with changing wheel radius during runtime

I’m very unfamiliar with C++ and struggling to get this to work. I want to be able to change the radius of a wheel when a custom event is fired

I’m using the wheel class built into unreal and the class defaults has the variable I want to change but must be compiled first and unaccessible from blueprints

here is the code for the shape radius in VehicleWheel.h. It says edit anywhere but I’m not sure what that means exactly.

Any help on the matter would be greatly appreciated!
Many Thanks,
Sean

It may be that the wheel sets these properties on initialization, in which case you’ll either need to set up a PostEditChange (or whatever it’s called, the event that gets fired when a blueprint var gets changed) or set up a function to re-initialize the wheel manually.

Been looking into this a bit for you :slight_smile: There is a CreateWheels and DestroyWheels functions that can be overridden in WheeledVehicleMovementComp which may do the trick after changing the radius (it’s a protected function so you will need to create your own WheeledVehicleMovementComp inheriting from that).

As of unreal 4.17 adding BlueprintReadWrite to a UPROPERTY will act accordingly, unless I was building the code in VS wrong all this time but I got it to work.

EDIT: Turns out i was able to change the radius and even get the wheel class to notice the change (Via Print text from radius) but it still doesn’t update during runtime. the wheel stays the same.

193606-solution2.png

If you have multiple tire details you can use the bit of code i threw together today.

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1505237-change-tire-on-runtime-bp-with-a-tiny-bit-of-c