Include pxvehicletankdrive.h

I am looking to create a tank movement component as it seems they skipped the N-wheels and tank models. Based on the nvidia documentation it looks like i should be able to piggyback off of vehiclemovementcomponent and the physxvehiclemanager. Same wheelsim and drivesim data, different rawinputdata and a few settings need to be set (Tankdrivemodel). My question is what is the best way to go about this? plugin, component, project class code? I am good with programming but weak on the engine structure side and how to include the needed header as it looks like physxinclude.h excludes it aswell. Will i break the engine or create a weird redundancy if i try to build a plugin with physx code that is not in the main engine? If it cannot be done by myself when is the tank model going to be implemented? Or is their some way to emulate wheelcollider that exists in Unity? (also physx based i believe)

Coding wise i can do it i just dont have a good grasp on fiddling with something this interconnected, this pretty much makes or breaks my project.

Thank you for any help

References:
http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/PxVehicleDriveTank_8h.html
https://developer.nvidia.com/sites/default/files/akamai/physx/Docs/Vehicles.html
http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/group__vehicle.html

My thoughts after a bit more reading is I should dynamically link my plugin to the physx library to avoid shipping physx with the plugin right? But is physx being loaded in its entirety by the engine or only the parts its using? (i.e 4W class only)

Or can i use the header and put SetupModulePhysXAPEXSupport(Target); in the plugin *.build.cs file? I was wondering where the engine source was getting access to the physx header, looks like i found it and it comes from unrealbuildtools and probably wouldnt have been as simple as adding a third party dependancy reference

Just create your own class derived from the UWheeledVehicleMovementComponent class and utilize the PhysX tank movement (you can find their API and samples online). You would then include PxVehicleDriveTank.h as well. This is what we did. Let me know if this helps or if I can provide more information.

#if WITH_VEHICLE
#include "PhysXIncludes.h"
#include "PxVehicleDriveTank.h"
#endif // WITH_VEHICLE

Did you do it at a source code level or as a class added to a project? Figured it out eventually by adding a derived class to the source code and some modifications to the input handling just havent built it yet

We added a new class to our project that derived from the UWheeledVehicleMovementComponent class and used the 4W as a template for how to implement it. There were a few work-arounds but it works fairly well. I’m just now working on getting the tank to turn tighter as it makes fairly wide turns. nVidia has a SnippetVehicleTank.cpp file that will show you how to basic things. (Source: SnippetVehicleTank example)

Also, our artists had a heck of a time getting the models setup correctly for the tracked vehicles. Maybe once we get the code solid I may consider sending it to Epic for inclusion in the engine.

We finally worked on getting our tank to turn tighter. Our workaround was to reduce the mass to about 1/10th of the real mass and then have the torque of the engine occur sooner. Like have nearly full torque at 200 rpm and the tank was more responsive. We also had to tweak the ThrottleInput and SteeringInput RiseRates and FallRates to get it all working nicely. Now we have a tank that uses PhysX and can pivot in place and responds like a tank should. Let me know if you need any help. Which project are you working on?

Working on a personal project in my free time, if it gets anywhere you’ll see it popup in the WIP part of the forum! So tried your way as redownloading the source code each new release has become a burden. The issue I ran into is it cannot find the PxVehicleTankDrive.h and throws a bunch of other missing header files. So how did you get around this? Add the physx directory as an external dependency? I know how to code, just building things is wizardry to me!

You have to add PhysX and APEX (for some reason I needed both) as an external dependency. I tacked them on after Engine, etc. in the *.Build.cs file.

So got to a point where it builds just fine, can create a class and add the skeletal mesh. But the anim BP does not update the wheels! I turned on the vehicle debug and the wheels are there and operating like they should but not translating to the bones. I think I know what I did, I created an actor class that inherits from APawn like WheeledVehicle, but AnimeNode_WheelHandler.cpp checks to see if the parent is a WheeledVehicle, fails that cast test, and never inits!!! How did you get the animations updated? I feel like piggybacking off of the wheeledvehicle setup is killing me

Well that makes sense to me. Why did you create a blueprint that inherits from APawn? Why didn’t you create a blueprint that inherits from your custom class you just created? If you do that it will probably work.

Can you help me with getting this running too ?

What issues are you having?

Could you help me with the input part.How did you set input for tank.How did you implement the right and left track thrust,Since there is support for that in WheeledVehicleMovement