Maya to Unreal Engine 4 - Wheeled Vehicle

 

The Story

As many people may have noticed while trying to implement their own created or sourced vehicle on top of the Wheeled Vehicle class in Unreal Engine 4, it doesn't quite work. Either the vehicle seemingly ignores collision and sinks into the ground or the tires begin spinning on a weird axis. I came across these same issues with what I imagine was the same response as many, lots of forum posts asking the question and not a lot of answers. So I dug further into it and with the utilization of Unreals "showdebug vehicle" command and discovered that the tire collision meshes where rotated 90 degrees. They were spinning for what that's worth but it wasn't going to get the vehicle very far.

So what was causing this? I followed the official UE4 tutorials and unofficial tutorials to the letter. Turns out it was Mayas fault. The way Maya handles local Axis does not play nice with UE4 which means we have to force it to play nice.

The Process:

Set-up:
Make sure your vehicle is forward facing towards the X-Axis and the wheels are separated from the main body.

  1. Rotate the vehicle body 90 degrees on the X-Axis. Make sure that the pivot point of the vehicles body is centered otherwise when it comes time to generate collision physics bodies, things will go to hell.
  2. Freeze the rotation that we just made. This is key as we are now about to force the local rotation that we need.
  3. Rotate the vehicle body back into position (-90 degrees on X axis) and then parent the vehicle tires to the vehicle body. We have now forced the correct Axis, however we need to freeze it to take full effect.
  4. Select all of the vehicle tires, notice they have inherited the -90 degree rotation from the parent, and now freeze that rotation. The tires have now been forced onto Unreals axis permanently (zeroed out rotation).
  5. To confirm the process has been completed correctly, select one of the vehicle tyres with the move tool. Change the move tools axis from World to Object. You should now notice that the tyres axis has changed and is different from the worlds with the Z-Axis now pointing up.
All done. A simple fix that took way to long to find. Now you just need to export everything together as an FBX file and import it into UE4 (and make sure you import as a skeletal mesh).

Related Issues:

  • Do not scale the vehicle on Import. This will cause the wheels to not line up propery
  • WheeledVehicle classes torque curve does not work. After searching it appears this is not a priority for the Unreal development team and dates back to 2016 as not working.

Comments