I know its there but where? PhysX installation
by Donald Teal · in Torque 3D Professional · 08/16/2010 (5:29 pm) · 36 replies
Okay,
I know there was a thread on how to integrate Physx into custom code, but I cant seem to find it.
So maybe someone can direct me to what I need to do to get physX working in my code?
Thanks
I know there was a thread on how to integrate Physx into custom code, but I cant seem to find it.
So maybe someone can direct me to what I need to do to get physX working in my code?
Thanks
About the author
#2
Also this is for 1.1b2 if that changes anything. I was reading in the other threads about physX problems. have any of these been fixed with latest releases of physX software or T3D. If the problems have not been addressed would Bullet physics be a better choice? Can anyone give the pro/cons of each that has experience with them. I am just trying to get a more interactive environment for my game.
08/16/2010 (6:46 pm)
well I dont mind rebuild the source but any info on the integration of physX is appreciated. this is my first time trying to get it going.Also this is for 1.1b2 if that changes anything. I was reading in the other threads about physX problems. have any of these been fixed with latest releases of physX software or T3D. If the problems have not been addressed would Bullet physics be a better choice? Can anyone give the pro/cons of each that has experience with them. I am just trying to get a more interactive environment for my game.
#3
08/16/2010 (7:24 pm)
Quote:I was reading in the other threads about physX problemsWhat kind of problems are these? The only problem i had with PyshX in 1.1b was the buggy player's collision, that fortunately is fixed now. The only negative things i can say about PhysX so far is: that it makes the game slower (duh). The player's pose collision is not calculated (yet i believe). It also disables the collision between the player and vehicles and StaticShapes, but when using a physics plugin PhysicsShape is the replacement for StaticShapes. As for vehicles, I'm not sure wheter or not TP has plans to implement that, but I'll be working on that anyways, probably release a fix as a resource (almost got it to work btw.).
Quote:Bullet physics be a better choice?According to Tom, bullet physics are really slow. I'm not sure slow is the right word for it but if you go in the physics demo that comes with torque and type physicsInit(Bullet); in the console before starting the level, you can see how bullet physics are working so far.
Quote:rebuild the sourcenot re-build, re-generation. Difference? Well, basically, re-generation of project files means that you delete the existing project files, and generates new ones.
#4
08/16/2010 (9:08 pm)
bugs such as the bouncing players on uneven terrain and collision issues. we are looking for movable/collidable/destroyable objects in our missions and we also have vehicles.
#5
strange no one else is replying to this thread =/
08/16/2010 (9:17 pm)
Quote:bugs such as the bouncing players on uneven terrain and collision issuesThis one is fixed in 1.1b2 (pfew).
Quote:and we also have vehiclesThis might become troublesome. Collision against vehicles are currently not working in 1.1b2 with PhysX, and I'm not sure whether or not TP has any plans of fixing this. Since I use both PhysX and Vehicles I'm going to try to fix the vehicle's collision my self, and if i do so I'll probably post the fix as well, but I'm not promising anything.
strange no one else is replying to this thread =/
#6
08/16/2010 (9:54 pm)
well I am a complete noob when it come to getting physX to work is there a physX for dummies install guide? as far as what files to add and where to put then or if its as simple as setting it in script or code to enable it somewhere. can you descibe more in detail the collision with vehicles issue you have seen. This may be a desciding factor for me.
#7
08/16/2010 (10:13 pm)
Quote:as far as what files to add and where to put then or if it's as simple as setting it in script or code to enable it somewhereYou did look in the thread i pointed you to in comment #1 right?
Quote:can you describe more in detail the collision with vehicles issue you have seenNot sure if you can call it an issue, it's more of a missing feature. In other words, there is no collision. But I'm currently working on the fix, and have achieved something. I'll report back tomorrow regarding the fix.
#8
doesn't say what physX files/projects or where they came from to be put into the torque project. unless I am just being brainless. which is entirely possible.
As far as the vehicle collision, do you get any collision at all with terrain, buildings, trees, any of the above? I guess I am asking if that is any collision at all be it with the player of the terrain and items on said terrain.
08/16/2010 (10:17 pm)
Quote: Ive gotten the source files added to the engine (t3dphysicsphysx) and the other two additional projects nxCharacter nxuStream
doesn't say what physX files/projects or where they came from to be put into the torque project. unless I am just being brainless. which is entirely possible.
As far as the vehicle collision, do you get any collision at all with terrain, buildings, trees, any of the above? I guess I am asking if that is any collision at all be it with the player of the terrain and items on said terrain.
#9
EDIT: More specific Torque 3D 2009 Pro 1.1 Beta 2\Demos\Physics\buildFiles\VisualStudio 2008\projects
08/16/2010 (10:25 pm)
Hmm, true, well, I did actually not follow that thread so much when integrating PhysX in my project, but nxCharacter and nxuStream are the projects located in the PhysX buildFiles folder (the one that comes with T3D), just copy them to your build folder and add them to your solution.EDIT: More specific Torque 3D 2009 Pro 1.1 Beta 2\Demos\Physics\buildFiles\VisualStudio 2008\projects
#10
08/16/2010 (10:31 pm)
ok thanks for that. I will wait for your vehicle results for now. have some other things that need some attention that will take at least that long.
#11
Took a couple of hours, but we both needed it :D,
To install, just replace the existing vehicle.cpp and .h, if you have some custom code, then use a comparing software to merge the files (Ex. WinMerge).
I haven't really looked for buggs with the collision so far, so if you find anything, just tell me.
08/16/2010 (11:42 pm)
Here you are: LinkyTook a couple of hours, but we both needed it :D,
To install, just replace the existing vehicle.cpp and .h, if you have some custom code, then use a comparing software to merge the files (Ex. WinMerge).
I haven't really looked for buggs with the collision so far, so if you find anything, just tell me.
#12
08/17/2010 (1:32 am)
nope no custom vehicle code as of yet but its coming. Got to get my Zeplin type craft going. will try to get PhysX installed with your vehicle code in the morning and let you know how it goes. thanks for all the help
#13
here is what I have done so far
added nxCharacter and nxuStream to my C:TorqueT3D B2My ProjectstestingbuildFilesVisualStudio 2008projects folder
edited /buildFiles/config/project.conf to include
in VS2008 went to tools then options and in projects and solutions VC++ Directories added C:Program Files (x86)NVIDIA CorporationPhysX
then in solution added nxCharacter and nxuStream
and in Source Files/Engine/T3D/physics/ I added the physX folder and all contents to the project.
ran the generateProjects command in my project.
opened project in VS2008 did a clean solution and then Build Solution.
getting this error
what did I screw up or what step did I miss
EDIT: changed the directory of the PhysX install to the physX SDK install at C:Program Files (x86)NVIDIA CorporationNVIDIA PhysX SDKv2.8.3SDKs
now project is building. will be testing after the debug is finished building and will let you know
EDIT 2: well I transferred some of the physX objects from the example
and add files physicsShape.cs and physX.cs to /game/scripts/server/
execute them in /game/scripts/server/scriptExec.cs with
exec( "./physX.cs" );
exec("./physicsShape.cs");
add files physicsShape.cs and physX.cs to /game/art/datablocks/
execute them in /game/art/datablocks/datablockExec.cs with
exec( "./physX.cs" );
exec("./physicsShape.cs");
and comment out
// Add a rigid example
//exec("./rigidShape.cs");
but no physics. something is still missing but I dont know what
08/19/2010 (5:11 pm)
ok still trying to get physX installed and working in a test project.here is what I have done so far
added nxCharacter and nxuStream to my C:TorqueT3D B2My ProjectstestingbuildFilesVisualStudio 2008projects folder
edited /buildFiles/config/project.conf to include
includeModule ( 'physx');
in VS2008 went to tools then options and in projects and solutions VC++ Directories added C:Program Files (x86)NVIDIA CorporationPhysX
then in solution added nxCharacter and nxuStream
and in Source Files/Engine/T3D/physics/ I added the physX folder and all contents to the project.
ran the generateProjects command in my project.
opened project in VS2008 did a clean solution and then Build Solution.
getting this error
Error 30 fatal error C1083: Cannot open compiler generated file: '../../Link/VC2k8.Release.Win32/testingmain.sbr': Permission denied c:TorqueT3D B2Enginesourcemainmain.cpp 1
what did I screw up or what step did I miss
EDIT: changed the directory of the PhysX install to the physX SDK install at C:Program Files (x86)NVIDIA CorporationNVIDIA PhysX SDKv2.8.3SDKs
now project is building. will be testing after the debug is finished building and will let you know
EDIT 2: well I transferred some of the physX objects from the example
and add files physicsShape.cs and physX.cs to /game/scripts/server/
execute them in /game/scripts/server/scriptExec.cs with
exec( "./physX.cs" );
exec("./physicsShape.cs");
add files physicsShape.cs and physX.cs to /game/art/datablocks/
execute them in /game/art/datablocks/datablockExec.cs with
exec( "./physX.cs" );
exec("./physicsShape.cs");
and comment out
// Add a rigid example
//exec("./rigidShape.cs");
but no physics. something is still missing but I dont know what
#14
Anyways, thats one alternative, the second one (the one i used) is to have a look at the project settings of the existing PhysX build, and just copy the stuff that your projects are missing, if you can't figure it out, i can send you the list of directories you need to include.
(Projects = buildFiles)
08/19/2010 (6:07 pm)
Just FYI includeModule ( 'physx'); does nothing unless you re-generate your projects (by using the generateProjects.bat located in the base folder, you might also need to delete the projects before generating). Basically what it does is fixing the setting of the projects to be compatible with PhysX.Anyways, thats one alternative, the second one (the one i used) is to have a look at the project settings of the existing PhysX build, and just copy the stuff that your projects are missing, if you can't figure it out, i can send you the list of directories you need to include.
(Projects = buildFiles)
#15
did this but still no physics. gonna go check the solutions again to see if I missed something
EDIT: ok the physics demo also includes bullet adding that to solution and testing now
08/19/2010 (6:52 pm)
Quote:ran the generateProjects command in my project.
opened project in VS2008 did a clean solution and then Build Solution.
did this but still no physics. gonna go check the solutions again to see if I missed something
EDIT: ok the physics demo also includes bullet adding that to solution and testing now
#16
Add to C++->General->Additional Include Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Physics/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Foundation/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/PhysXLoader/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Cooking/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/NxCharacter/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/Tools/NxuStream2;
Add to C++->Preprocessor->Preprocessor Definition:
TORQUE_PHYSICS_ENABLED
TORQUE_PHYSICS_BULLET
TORQUE_PHYSICS_PHYSX
Add to Linker->General->Additional Library Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/lib/Win32;
Add to Linker->Input->Additional Dependencies:
PhysXCooking.lib
PhysXLoader.lib
Add to Resources->General->Additional Include Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Physics/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Foundation/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/PhysXLoader/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Cooking/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/NxCharacter/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/Tools/NxuStream2;
08/19/2010 (7:29 pm)
Here is a list of the stuff that needs to be added to a project to make work with PhysX (also posted for future reference):Add to C++->General->Additional Include Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Physics/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Foundation/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/PhysXLoader/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Cooking/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/NxCharacter/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/Tools/NxuStream2;
Add to C++->Preprocessor->Preprocessor Definition:
TORQUE_PHYSICS_ENABLED
TORQUE_PHYSICS_BULLET
TORQUE_PHYSICS_PHYSX
Add to Linker->General->Additional Library Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/lib/Win32;
Add to Linker->Input->Additional Dependencies:
PhysXCooking.lib
PhysXLoader.lib
Add to Resources->General->Additional Include Directories:
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Physics/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Foundation/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/PhysXLoader/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/Cooking/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/SDKs/NxCharacter/include;
C:/Program Files/NVIDIA Corporation/NVIDIA PhysX SDK/v2.8.3/Tools/NxuStream2;
#17
getting this in console log
I am not running from D: nor does the \sw\ directory exist
08/19/2010 (10:02 pm)
ok well not sure what I am doing wrong now. I placed some physics objects in the mission some singles and some prefabs. I now have collision with them but they are static. no reaction to shooting them.getting this in console log
PhysX Warning: D:\sw\physx\PhysXSDK.8.3\trunk\SDKs\Physics\src\NpActor.cpp(818) : Static actor moved
I am not running from D: nor does the \sw\ directory exist
#18
08/20/2010 (3:05 pm)
I'm not sure this is the problem you are experiencing, but have you initialized the physics lib? Try typing physicsInit("physx"); before starting a mission and check it works. If so, you might want to add this line to scripts/main.cs. See how the PhysX project deals with TorqueScript stuff and compare.PhysX Warning: D:swphysxPhysXSDK.8.3trunkSDKsPhysicssrcNpActor.cpp(818) : Static actor movedYeah, that's a harmless message that only spams your console. D: is an tempromary/ilusionary directory PhysX uses
#19
EDIT: this is from the log
still no change in mission. if I add the barrel pyramid above the terrain and start the mission they fall and break apart when they hit the terrain as they should but still they dont react to anything from the player other than the player does have collision and can walk on them.
Are there and C++ code changes needed to enable the physics?
EDIT: well something is working. I can shoot the players corpse and it throws it
maybe I missed something that goes with the physics objects.
08/20/2010 (4:56 pm)
still working on this. seems VS2008 is not saving the libraries and such. still trying things will keep you informedEDIT: this is from the log
==>physicsInit("physX");
1still no change in mission. if I add the barrel pyramid above the terrain and start the mission they fall and break apart when they hit the terrain as they should but still they dont react to anything from the player other than the player does have collision and can walk on them.
Are there and C++ code changes needed to enable the physics?
EDIT: well something is working. I can shoot the players corpse and it throws it
maybe I missed something that goes with the physics objects.
#20
Tell me, is it the projectiles that you have a problem with or is it the player. If it is the projectile then I'll let you know that some changes are required (TorqueScript) to make them affect PhysX objects. If you have some sort of comparing software (winMerge, Beyond Compare) then use it to compare files from existing PhysX build and your project. I'm aware that you have to make changes in scripts/server/radiusDamage.cs and you have to add an onCollision event to all your projectiles, see art/datablocks/weapons/rocketLauncher.cs in the PhysX demo for an example of the onCollision event.
But my last advice to integrate PhysX in an full template is to have a look at the difference between the existing PhysX demo, and your project, both source and TorqueScript.
08/20/2010 (9:09 pm)
Quote:Are there and C++ code changes needed to enable the physics?There shouldn't be since both the physics demo and the FPS example uses the same source files. And plus, i do already have it working in my project, so I'm quiet sure.
Tell me, is it the projectiles that you have a problem with or is it the player. If it is the projectile then I'll let you know that some changes are required (TorqueScript) to make them affect PhysX objects. If you have some sort of comparing software (winMerge, Beyond Compare) then use it to compare files from existing PhysX build and your project. I'm aware that you have to make changes in scripts/server/radiusDamage.cs and you have to add an onCollision event to all your projectiles, see art/datablocks/weapons/rocketLauncher.cs in the PhysX demo for an example of the onCollision event.
But my last advice to integrate PhysX in an full template is to have a look at the difference between the existing PhysX demo, and your project, both source and TorqueScript.
Torque 3D Owner Marcus L
If you don't want to re-generate your project files, i could give you full instructions on how to integrate PyshX without re-generation of project files.