I’m currently working on setting up the base classes for the vehicle classes in my game but i have gotten a bit confused.
I want to use the UWheeledVehicleMovementComponent and the child class that is used for four wheel vehicles, i’m planning on placing the components in classes that inherit from APawns.
What has gotten me confused is how to properly include these files. I cannot seem to find the classes under “Vehicles/”, i only have TireTypes.h in that directory. But if i however just do #include "WheeledVehicleMovementComponent4W.h" and create the component normally it compiles for some reason. But the code has red underline and i cannot access the variables or functions of the created component, which leads me to believe that this is not the correct way of doing it. (I cannot see a preview of the variables/functions when using “->”, but it compiles?)
If i mouse over the class name i get “identifier “UWheeledVehicleMovementComponent4W” is undefined”.
I have tried adding “PhysX” and “APEX” to the Build.cs file, but nothing changed.
Could anyone explain how they are including the classes? Thanks!
You’ll have to include the PhysXVehicles plugin into your uproject file. The header file you’re looking for is under Engine\Plugins\PhysXVehicles\Public. Once you’ve included the plugin you should be able to include the component and access all of its member variables and functions.
Keep in mind that Intellisense sometimes thinks code is wrong when it isn’t. The best way to determine if its wrong is to build and watch the Output window for any compiler errors.
Ah! Now it’s working!
Thank you, was getting pretty irritated.
And for anyone who has a similar problem, don’t forget to generate new visual studio files after editing the .uproject file.
I think the modification on .Build.cs is also needed.
I tested this on UE4.23 with VS2019 and to pass the build I must add PhysXVehicles to both .uproject and .Build.cs