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"

What is required to be able to write PhysX code / use physics types? Including PhysX module is not sufficient

Dear Friends at Epic,

I would like to do some PhysX code writing in DestructibleComponent sublcass that is contained with my game's project module.

I am not writing engine code, just project level code

I included PhysX as a module in my Build.cs!

I added these includes in my subclassed DestructibleComponent.cpp

 #include "PhysicsPublic.h"
 //#include "PhysicsEngine/PhysXSupport.h"
 //#include "Collision/PhysXCollision.h"

I wrote some sample code:

 //testing stuff
     #if WITH_PHYSX
     for(FDestructibleChunkInfo& Each : DestructibleComponent->ChunkInfos)
     {
         physx::PxRigidDynamic* Actor = Each.Actor;
          
         if(Actor)
         {
             PxTransform Trans = Actor->GetGlobalPose();
             PxVec3 PxLoc = Trans.p;
             
             FVector Location(PxLoc.x,PxLoc.y,PxLoc.z);
             
             DrawPoint(Location);
         }
     }
     #endif // WITH_PHYSX 


Issues

The two includes I have commented out wont compile!

 //#include "PhysicsEngine/PhysXSupport.h"
 //#include "Collision/PhysXCollision.h"

Compile says it cannot open these includes

Compile Errors

And when I compile I get these errors:

 1>------ Build started: Project: JoyShapes, Configuration: Development_Editor x64 ------
 1>  Performing 2 actions (max 4 parallel jobs)
 1>  Module.JoyShapes.1_of_3.cpp
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(167): error C2079: 'Trans' uses undefined class 'physx::PxTransform'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(167): error C2027: use of undefined type 'physx::PxRigidDynamic'
 1>          E:\VictoryUE4\UnrealEngine-4.3\Engine\Source\Runtime\Engine\Classes\PhysicsEngine/BodyInstance.h(19) : see declaration of 'physx::PxRigidDynamic'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(167): error C2227: left of '->GetGlobalPose' must point to class/struct/union/generic type
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(168): error C2079: 'PxLoc' uses undefined class 'physx::PxVec3'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(168): error C2228: left of '.p' must have class/struct/union
 1>          type is 'int'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(170): error C2228: left of '.x' must have class/struct/union
 1>          type is 'int'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(170): error C2228: left of '.y' must have class/struct/union
 1>          type is 'int'
 1>C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Source\JoyShapes\Private\Base\JoyDestruction.cpp(170): error C2228: left of '.z' must have class/struct/union
 1>          type is 'int'
 1>  -------- End Detailed Actions Stats -----------------------------------------------------------
 1>ERROR : UBT error : Failed to produce item: C:\Users\Rama\Documents\Unreal Projects\JoyShapes\Binaries\Win64\UE4Editor-JoyShapes.pdb
 1>  Cumulative action seconds (8 processors): 0.00 building projects, 8.58 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.00 linking, 0.00 other
 1>  UBT execution time: 23.08 seconds
 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "E:\VictoryUE4\UnrealEngine-4.3\Engine\Build\BatchFiles\Build.bat JoyShapesEditor Win64 Development "C:\Users\Rama\Documents\Unreal Projects\JoyShapes\JoyShapes.uproject"" exited with code -1.
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Question

What do I need to do so I can work with the Px var types?

Thanks!

Thanks!

Rama

Product Version: Not Selected
Tags:
more ▼

asked Aug 26 '14 at 03:12 PM in C++ Programming

avatar image

Rama
10.6k 446 346 1088

avatar image TimGS Aug 26 '14 at 04:42 PM

Did you add folder containing PhysicsEngine folder and Collision folder to your PublicIncludePaths in your Build.cs file?

avatar image Rama Aug 26 '14 at 07:58 PM

When I added PhysicsEngine as a module to my build CS, VS threw an exception cause it could not find PhysicsEngine!

!

:)

Rama

avatar image TimGS Aug 26 '14 at 08:12 PM

Mind to show your Build.cs? Because its really strange. I'm using third party libraries and never met such problems.

avatar image Rama Aug 27 '14 at 01:29 PM

I'm telling you, VS wont compile "PhysicsEngine" module :)

Have you been able to add the module PhysicsEngine as you are suggesting that I do?

 PublicDependencyModuleNames.AddRange(new string[] { 
                 "Core", 
                 "CoreUObject", 
                 "Engine", 
                 "InputCore",
                 
                 "RHI", 
                 "RenderCore", 
                 "ShaderCore",
 
                 "OnlineSubsystem",
                 "OnlineSubsystemUtils",
 
                 "Sockets","Networking",
 
                 "PhysX",
                 "PhysicsEngine",
                 "Collision",
 
                 "AIModule"
         });

 1>------ Build started: Project: JoyShapes, Configuration: Development_Editor x64 ------
 1>EXEC : error : Exception thrown while processing dependent modules of JoyShapes
 1>EXEC : error : Couldn't find module rules file for module 'PhysicsEngine'.
 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "E:\VictoryUE4\UnrealEngine-4.3\Engine\Build\BatchFiles\Build.bat JoyShapesEditor Win64 Development "C:\Users\Rama\Documents\Unreal Projects\JoyShapes\JoyShapes.uproject"" exited with code -1.
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



avatar image TimGS Aug 27 '14 at 04:17 PM

Seems like I got you wrong. I thought you're using PhysX SDK downloaded from nvidia. =)

I'll try this and see if it will go wrong.

avatar image Rama Sep 23 '14 at 01:13 PM

Any update on this?

I'd love to do some NVidia coding using the engine as is, but if I need an SDK I will be happy to use it. :)

avatar image TimGS Sep 23 '14 at 02:13 PM

Nope :( I can't even include PhysicsPublic.h because it gives a lot of compile errors.

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

1 answer: sort voted first

I answerd your qustion here if it stile don`t work i may have forgoten something let me know and we will figuer it out.

more ▼

answered Sep 23 '14 at 04:35 PM

avatar image

WCode
508 43 44 73

avatar image Rama Sep 24 '14 at 12:30 AM

Woohoo thanks for the help WCode!

Will let you know soon as I get a test working :)

avatar image WCode Sep 24 '14 at 06:18 AM

Realy glad i could help out and nice wiki, i have been doing a lot of un-necesary steps it seems.:)

avatar image Rama Sep 24 '14 at 01:21 PM

Woohoo!

Victory!

Thanks WCode!

I just needed that 1 include!

I've posted a wiki about it, feel free to create an additional one or add your own section to mine with additional code samples, putting your signature by your code (can use the short cut of ~~~ for wiki signature)

https://wiki.unrealengine.com/PhysX,_Integrating_PhysX_Code_into_Your_Project#.h Rama

PS: if you convert your response to an answer I can give you credit :)

alt text

avatar image Rama Sep 24 '14 at 01:22 PM

Thanks Again for the tip about that include WCode!

Rama

avatar image WCode Sep 24 '14 at 07:49 PM

My plesure :) glad i could help.

(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