x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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

Product Version: Not Selected
Tags:
more ▼

asked Sep 08 '14 at 11:41 PM in C++ Programming

avatar image

Wholegrainhunta
21 1 2 3

avatar image Wholegrainhunta Sep 09 '14 at 01:29 AM

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)

avatar image Wholegrainhunta Sep 09 '14 at 04:44 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Oct 26 '14 at 03:23 AM

avatar image

Kory
383 8 133 45

avatar image Wholegrainhunta Oct 26 '14 at 03:30 AM

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

avatar image Kory Oct 26 '14 at 03:39 AM

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.

avatar image Kory Oct 27 '14 at 03:50 AM

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?

avatar image Wholegrainhunta Nov 20 '14 at 09:00 AM

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!

avatar image Kory Nov 20 '14 at 10:47 AM

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.

avatar image Wholegrainhunta Nov 30 '14 at 08:02 AM

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

avatar image Kory Nov 30 '14 at 01:33 PM

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.

avatar image CaptainTiiti Nov 22 '15 at 08:05 PM

Can you help me with getting this running too ?

avatar image Kory Nov 22 '15 at 08:54 PM

What issues are you having?

avatar image Freedom911 Feb 27 '18 at 04:52 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question