PhysX in TGE Version 0.3 (Work-In-Progress)
by Shannon "ScarWars" Scarvaci · 07/03/2006 (11:35 am) · 269 comments
Outline
1. License
2. Get SDK from Ageia
3. Implementation
4. Scripts
5. Know Issues
6. Need your supports!
License:
The license of PhysX is following:
Get SDK from Ageiq
You can obtain the SDK from www.ageia.com website, my currently version for this physics is 2.7.0.
If you are using Visual Studio then you need to add "include" and "library" in the project configuration.
(If you using linux or mac, then i don't know where to setup because I dont have linux or mac with me)
Directory for include files:
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Physics\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Foundation\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\PhysXLoader\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Cooking\include
Directory for library files:
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\lib\win32
Note: These files' path's are relative to my hard drive, your files may be in different directory depending on how you installed the PhysX SDK.
Please install AGEIA PhysX Runtime in your PC (prefered lastest version)
Also put two dll file (PhysXLoader.dll and NxCooking.dll from AGEIA PhysX SDK\v2.7.0\SDKs\Bin\win32) in the example folder.
Implementation
Copy the 17 files from "PhysX" folder into engine/PhysX and modify some TGE's source code files.
Player
in game/player.h in bold
game/player.cc at the top in bold
game/player.cc in Player::Player() function
game/player.cc in Player::onAdd() function
game/player.cc in Player::setPosition(...)
Terrain
in terrain/terrData.cc
at the top of the file
terrain/terrData.cc in TerrainBlock::onAdd function near the end
Interior
in interior/interior.h
in interior/interiorInstance.h
in interior/interiorInstance.cc
TSStatic
in ts/tsShapeInstance.h
in game/tsStatic.h
in game/tsStatic.cc
ShapeBase
in game\shapeBase.h
Material in GameBase
in game\gameBase.h
Scripts
Copy three script files (PhysX.cs, physXActorBox.cs and physXActorSphere.cs) in starter.fps/server/scripts and add three lines of code in starter.fps/server/scripts/games.cs
add one line of code in common/client/mission.cs
and in every mission file need to add PhysXWorld as show in bold:
If you want to testing around by droping the object in the free-look camera, then use default.bind.cs script
Know Issues
Terrain is the problem here because PhysX can accept 256x256 collision mesh in their engine which is mean squareSize equal to one! So the TGE's default squareSize is 8 and you see object will miss the collision in some area of the terrain. Possible solution is to create chunks, for example if you use squareSize of 8 then use 64 chunks of 256x256 collision mesh.
Loading the mesh of 256x256 collision will very slow but there possible solution is to write the mesh to file create by PhysX engine and read the file from PhysX will be lots faster, similar to lighting system which is used in TGE.
I've tried number of way to use Terrain collision in PhysX such as split in four section, NxHeightfield which make it very slow but I haven't tried this in PPU yet. So I have to stick with 256x256 collision mesh for a while.
Player/ShapeBase collision with PhysX's object is not complete.
Networking:
Loading objects from the begin in the remote client sometime not showing but if object appear during the gameplay will work ok. That something i need to be working on. (There may be some problem because of improved speed, but didn't test it yet)
Improved PhysX Speed
Big thank to decryptoid for helping us in PhysX, esp. for speed improvement.
Need your supports!
Now you can play with PhysX in your TGE game! If you find any improvement for this Physics in coding or script or anything please post here and I'll happy to update in here.
Also please use TDNfor any info to advise for our community
In the future:
- Run in PPU.
- Player collision.
- ShapeBase, (TSStatic and Interior - Completed) collision.
- Use advance physics such as joints, clothes and fluid. Done two type of joints
Enjoy your Physics!
Check out the video.
First Video
Second Video
Joints Video (4MB, prefer download before watch)
This is my first resource, please be kind to me :)
Due to file limit please download from here Updated 13th Apirl 2006
Here TGEA PhysX Resource here
1. License
2. Get SDK from Ageia
3. Implementation
4. Scripts
5. Know Issues
6. Need your supports!
License:
The license of PhysX is following:
Free:
* Commercial & non-commercial use on PC
Must keep registration information currect
Must agree to the EULA at the time of download (pops up, but is copied below)
Available for Windows & Linux (soon)
No PhysX HW support requirement
* PS3 platform (through Sony pre-purchase)
* All platforms through some of our middleware partnerships, such as UE3, Gamebryo 2.2,
and others
k per platform:
* Xbox 360
* Fee may be waived at our discretion for multi-platform developers providing PC HW support
* Fee may be waived at our discretion for some Tools & Middleware providersGet SDK from Ageiq
You can obtain the SDK from www.ageia.com website, my currently version for this physics is 2.7.0.
If you are using Visual Studio then you need to add "include" and "library" in the project configuration.
(If you using linux or mac, then i don't know where to setup because I dont have linux or mac with me)
Directory for include files:
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Physics\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Foundation\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\PhysXLoader\include
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\Cooking\include
Directory for library files:
C:\Program Files\AGEIA PhysX SDK\v2.6.4\SDKs\lib\win32
Note: These files' path's are relative to my hard drive, your files may be in different directory depending on how you installed the PhysX SDK.
Please install AGEIA PhysX Runtime in your PC (prefered lastest version)
Also put two dll file (PhysXLoader.dll and NxCooking.dll from AGEIA PhysX SDK\v2.7.0\SDKs\Bin\win32) in the example folder.
Implementation
Copy the 17 files from "PhysX" folder into engine/PhysX and modify some TGE's source code files.
Player
in game/player.h in bold
//----------------------------------------------------------------------------
[b]struct sNxActor;[/b]
class Player: public ShapeBase
{
typedef ShapeBase Parent;
[b]sNxActor *mActor;[/b]
protected:
/// Bit masks for different types of events
enum MaskBits {game/player.cc at the top in bold
//----------------------------------------------------------------------------- // Torque Game Engine // Copyright (C) GarageGames.com, Inc. //----------------------------------------------------------------------------- [b]#include "physX/PhysX.h" #include "physX/PhysXWorld.h"[/b] #include "game/player.h"
game/player.cc in Player::Player() function
mMountPending = 0; [b]mActor = NULL;[/b] }
game/player.cc in Player::onAdd() function
gCamFXMgr.clear();
}
[b]PhysXWorld *PxWorld = PhysXWorld::getWorld(isServerObject());
if (PxWorld) {
mActor = PxWorld->AddShapeBase(this);
}[/b]
return true;game/player.cc in Player::setPosition(...)
else {
mat.set(EulerF(0, 0, rot.z));
mat.setColumn(3,pos);
}
[b]if (mActor) {
QuatF q(mat);
Point3F pos;
mat.getColumn(3,&pos);
NxQuat quat;
quat.setXYZW(q.x,q.y,q.z,q.w);
mActor->actor->setGlobalOrientationQuat(quat);
mActor->actor->setGlobalPosition(NxVec3(pos.x,pos.y,pos.z));
}[/b]
Parent::setTransform(mat);
mRot = rot;
}Terrain
in terrain/terrData.cc
at the top of the file
#include "terrain/terrRender.h" #include "terrain/blender.h" [b]#include "physX/PhysXWorld.h"[/b] extern bool gDGLRender;
terrain/terrData.cc in TerrainBlock::onAdd function near the end
if(!unpackEmptySquares())
return(false);
[b]PhysXWorld *PxWorld = PhysXWorld::getWorld(isServerObject());
if (PxWorld) {
PxWorld->SetupTerrainCollision(); // old style
}[/b]
return true;
}Interior
in interior/interior.h
class Interior
{
...
friend class EditInteriorResource;
[b]friend class PhysXInterior;[/b]in interior/interiorInstance.h
class InteriorInstance : public SceneObject
{
...
friend class FloorPlan;
[b]friend class PhysXInterior;
friend class PhysXWorld;[/b]in interior/interiorInstance.cc
#include "platform/profiler.h"
[b]#include "physX/PhysXWorld.h"[/b]
...
bool InteriorInstance::onAdd()
{
...
addToScene();
[b]PhysXWorld *PxWorld = PhysXWorld::getWorld(isServerObject());
if (PxWorld) {
PxWorld->SetupInterior(*this);
}[/b]
return true;
}TSStatic
in ts/tsShapeInstance.h
class TSShapeInstance
{
...
friend class TSPartInstance;
[b]friend class PhysXTSStatic;
friend class PhysXActor;[/b]in game/tsStatic.h
class TSStatic : public SceneObject
{
...
friend class TSStaticConvex;
[b]friend class PhysXTSStatic;[/b]in game/tsStatic.cc
#include "sim/netConnection.h"
[b]#include "physX/PhysXWorld.h"[/b]
...
bool TSStatic::onAdd()
{
...
addToScene();
[b]PhysXWorld *PxWorld = PhysXWorld::getWorld(isServerObject());
if (PxWorld) {
PxWorld->SetupTSStatic(*this);
}[/b]
return true;
}ShapeBase
in game\shapeBase.h
class ShapeBase : public GameBase
{
typedef GameBase Parent;
friend class ShapeBaseConvex;
friend class ShapeBaseImageData;
[b]friend class PhysXWorld;[/b]Material in GameBase
in game\gameBase.h
[b]struct PhysXMaterialData;[/b]
struct GameBaseData : public SimDataBlock {
...
void unpackData(BitStream* stream);
[b]// PhysX
PhysXMaterialData* mMaterialBlock;[/b]
};
...
class GameBase : public SceneObject
{
...
enum GameBaseMasks {
InitialUpdateMask = Parent::NextFreeMask,
DataBlockMask = InitialUpdateMask << 1,
ExtendedInfoMask = DataBlockMask << 1,
ControlMask = ExtendedInfoMask << 1,
[b]//NextFreeMask = ControlMask << 1
// PhysX
MaterialDataBlockMask = ControlMask << 1,
NextFreeMask = MaterialDataBlockMask << 1[/b]
};
...
[b]// PhysX
bool setMaterialDataBlock(PhysXMaterialData* dptr);
bool onNewMaterialDataBlock(PhysXMaterialData* dptr);[/b]
};
...in game\gameBase.cc[b]#include "physX/PhysX.h"
#include "physX/PhysXActor.h"[/b]
#include "platform/platform.h"
...
GameBaseData::GameBaseData()
{
...
[b]mMaterialBlock = 0;[/b]
}
...
[b]IMPLEMENT_CONSOLETYPE(PhysXMaterialData)
IMPLEMENT_GETDATATYPE(PhysXMaterialData)
IMPLEMENT_SETDATATYPE(PhysXMaterialData)[/b]
void GameBaseData::initPersistFields()
{
Parent::initPersistFields();
...
[b]addField("materialBlock", TypePhysXMaterialDataPtr, Offset(mMaterialBlock, GameBaseData));[/b]
}
...
bool GameBase::onNewDataBlock(GameBaseData* dptr)
{
...
[b]onNewMaterialDataBlock(mDataBlock->mMaterialBlock);[/b]
setMaskBits(DataBlockMask);
return true;
}
...
bool GameBase::setDataBlock(GameBaseData* dptr)
{
...
}
[b]bool GameBase::setMaterialDataBlock(PhysXMaterialData* dptr)
{
if (isGhost() || isProperlyAdded()) {
if (mDataBlock->mMaterialBlock != dptr)
return onNewMaterialDataBlock(dptr);
}
else
mDataBlock->mMaterialBlock = dptr;
return true;
}
bool GameBase::onNewMaterialDataBlock(PhysXMaterialData* dptr)
{
mDataBlock->mMaterialBlock = dptr;
if (!mDataBlock->mMaterialBlock)
return false;
setMaskBits(MaterialDataBlockMask);
return true;
}[/b]
...
U32 GameBase::packUpdate(NetConnection *, U32 mask, BitStream *stream)
{
...
[b]if (stream->writeFlag((mask & MaterialDataBlockMask) && mDataBlock->mMaterialBlock != NULL)) {
stream->writeRangedU32(mDataBlock->mMaterialBlock->getId(),
DataBlockObjectIdFirst,
DataBlockObjectIdLast);
}[/b]
// cafTODO: ControlMask
return 0;
}
void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
{
...
[b]if (stream->readFlag()) {
PhysXMaterialData* dptrMD = 0;
SimObjectId id = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
if (!Sim::findObject(id,dptrMD) || !setMaterialDataBlock(dptrMD))
con->setLastError("Invalid packet GameBase::unpackUpdate()");
}[/b]
}Scripts
Copy three script files (PhysX.cs, physXActorBox.cs and physXActorSphere.cs) in starter.fps/server/scripts and add three lines of code in starter.fps/server/scripts/games.cs
// PhysX
exec("./physX.cs");
exec("./physXActorBox.cs");
exec("./physXActorSphere.cs");
exec("./physXJoints.cs");add one line of code in common/client/mission.cs
function clientCmdMissionStart(%seq)
{
// The client recieves a mission start right before
// being dropped into the game.
[b]startPhysX();[/b]
}and in every mission file need to add PhysXWorld as show in bold:
new SimGroup(MissionGroup) {
[b]new PhysXWorld() {
errorReport = false; // set to true if you want error report from PhysX
};[/b]
new ScriptObject(MissionInfo) {
...If you want to testing around by droping the object in the free-look camera, then use default.bind.cs script
function addCrate(%val)
{
if (%val)
commandToServer('pxcrate');
}
function addBox(%val)
{
if (%val)
commandToServer('pxbox');
}
function addRock(%val)
{
if (%val)
commandToServer('pxsphere');
}
moveMap.bind( keyboard, "alt r", addCrate);
moveMap.bind( keyboard, "alt t", addBox);
moveMap.bind( keyboard, "alt y", addRock);Know Issues
Terrain is the problem here because PhysX can accept 256x256 collision mesh in their engine which is mean squareSize equal to one! So the TGE's default squareSize is 8 and you see object will miss the collision in some area of the terrain. Possible solution is to create chunks, for example if you use squareSize of 8 then use 64 chunks of 256x256 collision mesh.
Loading the mesh of 256x256 collision will very slow but there possible solution is to write the mesh to file create by PhysX engine and read the file from PhysX will be lots faster, similar to lighting system which is used in TGE.
I've tried number of way to use Terrain collision in PhysX such as split in four section, NxHeightfield which make it very slow but I haven't tried this in PPU yet. So I have to stick with 256x256 collision mesh for a while.
Player/ShapeBase collision with PhysX's object is not complete.
Networking:
Loading objects from the begin in the remote client sometime not showing but if object appear during the gameplay will work ok. That something i need to be working on. (There may be some problem because of improved speed, but didn't test it yet)
Improved PhysX Speed
Big thank to decryptoid for helping us in PhysX, esp. for speed improvement.
Need your supports!
Now you can play with PhysX in your TGE game! If you find any improvement for this Physics in coding or script or anything please post here and I'll happy to update in here.
Also please use TDNfor any info to advise for our community
In the future:
- Run in PPU.
- Player collision.
- ShapeBase, (TSStatic and Interior - Completed) collision.
- Use advance physics such as joints, clothes and fluid. Done two type of joints
Enjoy your Physics!
Check out the video.
First Video
Second Video
Joints Video (4MB, prefer download before watch)
This is my first resource, please be kind to me :)
Due to file limit please download from here Updated 13th Apirl 2006
Here TGEA PhysX Resource here
About the author
#242
I have implemented and built the code without any warning and Errors, but I'm still having some troubles.
When I load the phys_test.mis the engine crashes. I did a little more testing and commented out some things. If I comment out the new physXWorld the mission opens but doesn't work as expected. I know the code wouldnt work but I just wanted to narrow the issue.
I figured this was probably something I missed or did wrong so I went over the tutorial again and followed it step by step checking everything. I could not find anything different or wrong. I am using the most current head.
If anyone has had similar issues I would be most great full for the help.
Lucus
Update
I feel like a noob. I was using the latest sdk which caused some Errors. I downloaded 2.64 and it works great.
Thanks for the resource its wonderful
Lucus
06/27/2008 (9:54 am)
Hey all,I have implemented and built the code without any warning and Errors, but I'm still having some troubles.
When I load the phys_test.mis the engine crashes. I did a little more testing and commented out some things. If I comment out the new physXWorld the mission opens but doesn't work as expected. I know the code wouldnt work but I just wanted to narrow the issue.
new SimGroup(MissionGroup) {
// new PhysXWorld() {
// errorReport = false; // set to true if you want error report from PhysX
// };
new ScriptObject(MissionInfo) {
...I figured this was probably something I missed or did wrong so I went over the tutorial again and followed it step by step checking everything. I could not find anything different or wrong. I am using the most current head.
If anyone has had similar issues I would be most great full for the help.
Lucus
Update
I feel like a noob. I was using the latest sdk which caused some Errors. I downloaded 2.64 and it works great.
Thanks for the resource its wonderful
Lucus
#243
1. Download the zip linked in this resource and copy them according to the instructions given at the top of this page.
2. Download PhysX 2.6.4 from nVidia. They have an archive page link where you should be able to get version 2.6.4. You will also need to download the PhysX system software (the latest version should say that it supports 2.6.4), and while you're at it, get the game distro installer too since that's what you'll need to distribute with your game once it ships (it is MUCH smaller than the full-blown system software). I'm not certain if the latest version of PhysX will work with this resource as-is. I'm sure the modifications necessary would be minimal, but let's take things one at a time and just get it working with 2.6.4.
3. Follow all the instructions listed in the main resource EXACTLY, making all the code modifications exactly as listed (note that the changes are given in bold in the examples). If you're having problems, chances are you missed copying a line of code somewhere, so go back over the resource line-by-line and make sure you copied everything exactly. Also if you like, you can wrap all the PhysX additions using #ifdef / #endif lines like so:
#ifdef USE_AGEIA_PHYSX
// put PhysX code here
#endif
Then you just need to add "USE_AGEIA_PHYSX" in your preprocessor line in your VC++ project, or you can add it other ways with other compilers. Or simply #define it. Why do this? This will allow you to easily switch between PhysX-enabled code and stock TGE with a simple #define.
4. Make sure you add all the appropriate PhysX lib and include folders to your compiler so it knows where to search for them.
5. Make sure to add all the new PhysX .cpp files from the zip file to your project to avoid link errors.
6. If it still isn't working, make sure you've copied the DLLs mentioned above from the PhysX SDK's bin\win32 folder (NxCooking.dll and PhysXLoader.dll) into your example folder (or whatever folder you're running your Torque .exe from).
7. Be sure to put all 4 (the resources says 3) lines of code (the exec() statements) into starter.fps/server/scripts/games.cs and put them after all the other exec() datablock loading statements.
Now you should be able to get it to work! I hope that helps!
Quick question though: has anyone been able to fix the problem with crashing when you delete an actor? If so, please let us all know what you did to fix it.
08/12/2008 (2:39 pm)
Okay, for anyone still having trouble implementing this resource, here are the lessons I learned through all my troubles getting it to work. Here's a checklist you should go down before giving up. There's no reason you shouldn't be able to get this to work as long as you follow all the instructions:1. Download the zip linked in this resource and copy them according to the instructions given at the top of this page.
2. Download PhysX 2.6.4 from nVidia. They have an archive page link where you should be able to get version 2.6.4. You will also need to download the PhysX system software (the latest version should say that it supports 2.6.4), and while you're at it, get the game distro installer too since that's what you'll need to distribute with your game once it ships (it is MUCH smaller than the full-blown system software). I'm not certain if the latest version of PhysX will work with this resource as-is. I'm sure the modifications necessary would be minimal, but let's take things one at a time and just get it working with 2.6.4.
3. Follow all the instructions listed in the main resource EXACTLY, making all the code modifications exactly as listed (note that the changes are given in bold in the examples). If you're having problems, chances are you missed copying a line of code somewhere, so go back over the resource line-by-line and make sure you copied everything exactly. Also if you like, you can wrap all the PhysX additions using #ifdef / #endif lines like so:
#ifdef USE_AGEIA_PHYSX
// put PhysX code here
#endif
Then you just need to add "USE_AGEIA_PHYSX" in your preprocessor line in your VC++ project, or you can add it other ways with other compilers. Or simply #define it. Why do this? This will allow you to easily switch between PhysX-enabled code and stock TGE with a simple #define.
4. Make sure you add all the appropriate PhysX lib and include folders to your compiler so it knows where to search for them.
5. Make sure to add all the new PhysX .cpp files from the zip file to your project to avoid link errors.
6. If it still isn't working, make sure you've copied the DLLs mentioned above from the PhysX SDK's bin\win32 folder (NxCooking.dll and PhysXLoader.dll) into your example folder (or whatever folder you're running your Torque .exe from).
7. Be sure to put all 4 (the resources says 3) lines of code (the exec() statements) into starter.fps/server/scripts/games.cs and put them after all the other exec() datablock loading statements.
Now you should be able to get it to work! I hope that helps!
Quick question though: has anyone been able to fix the problem with crashing when you delete an actor? If so, please let us all know what you did to fix it.
#244
In PhysicsWorld.cpp, make the following change:
...
gScene->releaseActor(*actor.actor);
actor.actor = NULL; // <-- New line of code which should fix it.
actor.active = false;
...
Apparently, Torque continues to call interpolateTick() a few times even after it has called onRemove() on an object being deleted from the scene. So the code in interpolateTick() was using the actor pointer that was no longer valid because it was released earlier. But setting the pointer to NULL solves it because interpolateTick() already does a check for a null actor and aborts.
A note for the future, anytime you release a PhysX object (be it an actor, scene, whatever), according to the docs, you should NEVER retain a pointer to that object anymore because once it is released, it is invalid. Keeping the pointer around is only inviting a crash.
I hope that helps!
08/20/2008 (4:18 am)
I've found the solution to the crash when you remove an actor from the world:In PhysicsWorld.cpp, make the following change:
...
gScene->releaseActor(*actor.actor);
actor.actor = NULL; // <-- New line of code which should fix it.
actor.active = false;
...
Apparently, Torque continues to call interpolateTick() a few times even after it has called onRemove() on an object being deleted from the scene. So the code in interpolateTick() was using the actor pointer that was no longer valid because it was released earlier. But setting the pointer to NULL solves it because interpolateTick() already does a check for a null actor and aborts.
A note for the future, anytime you release a PhysX object (be it an actor, scene, whatever), according to the docs, you should NEVER retain a pointer to that object anymore because once it is released, it is invalid. Keeping the pointer around is only inviting a crash.
I hope that helps!
#245
Any help would be greatly appreciated.
Thx.
08/27/2008 (11:55 am)
Ok, what the shizzz? I have download both the 2.6.4 and the newest version of 2.8.1 and neither of those sdk's have the file PhysXWorld.h or PhysicsWorld.h or any file that has the word "world" in it. Where are these files PhysX.h and PhysXWorld.h?Any help would be greatly appreciated.
Thx.
#246
08/27/2008 (12:19 pm)
@DALO - At the top of this page near the bottom of the resource post itself is a link to the zip containing the files you need.
#247
Thanks a bunch ;-)
08/27/2008 (2:16 pm)
ahhhhhh, silly me I saw the video files and just seemed to skip right past the most import piece of the puzzle.Thanks a bunch ;-)
#248
Thx.
08/28/2008 (7:23 am)
Ok, I have another question. I have followed the instructions as closely as I can and everything has compiled with no errors. When I play the test mission my player will not interact with the objects? I run into the rope, the bridge and the wall of blocks and it won't budge? I tried the boulder and that seems to roll on the ground fine so I know the physX is working but when I step in front of it the boulder goes right by me? Any ideas why my player cannot interact with objects? (I'm using the stock player, orc)Thx.
#249
To use the PhysX remote debugger, add the following lines to PhysXWorld.cpp:
// At the beginning of the file after your #includes:
#ifdef _DEBUG
NxRemoteDebugger* gRemoteDebugger;
#endif
// After your NxCreatePhysicsSDK() calls:
#ifdef _DEBUG
// Create Remote Debugger connection:
gRemoteDebugger = gPhysicsSDK->getFoundationSDK().getRemoteDebugger();
gRemoteDebugger->connect("localhost");
#endif
You can take out the #ifdefs if you want to be able to use the debugger with a release build, I just put that in there so it always gets built in on a debug build and won't show up in the release.
Now do a debug build (or release if you took our the #ifdefs), run the PhysX remote debugger, then, and only then, run Torque. As soon as your mission loads, you'll see the world in flat shaded polygons in the PhysX remote debugger and you'll be able to manipulate the world with it and see what all is going on. You can even record what happens and play it back later.
08/30/2008 (4:45 pm)
It "works" for me (sorta), but I've noticed that the player collision is a bit iffy. After running the PhysX remote debugger, I saw that the player uses a capsule for its collision, but it isn't set up right as the capsule behaves rather irratically. It wants to keep falling over, bouncing off the ground, etc, even while the player is sitting still. I think the player capsule needs some tweaking to get it to behave right. Look into how the player's capsule is being set up and use the PhysX remote debugger (under the bin\win32 folder of the PhysX SDK).To use the PhysX remote debugger, add the following lines to PhysXWorld.cpp:
// At the beginning of the file after your #includes:
#ifdef _DEBUG
NxRemoteDebugger* gRemoteDebugger;
#endif
// After your NxCreatePhysicsSDK() calls:
#ifdef _DEBUG
// Create Remote Debugger connection:
gRemoteDebugger = gPhysicsSDK->getFoundationSDK().getRemoteDebugger();
gRemoteDebugger->connect("localhost");
#endif
You can take out the #ifdefs if you want to be able to use the debugger with a release build, I just put that in there so it always gets built in on a debug build and won't show up in the release.
Now do a debug build (or release if you took our the #ifdefs), run the PhysX remote debugger, then, and only then, run Torque. As soon as your mission loads, you'll see the world in flat shaded polygons in the PhysX remote debugger and you'll be able to manipulate the world with it and see what all is going on. You can even record what happens and play it back later.
#250
Would there be a problem with me releasing my game (Commercial) with PhysX?
Im looking to port this/implement this in to the RTS Starter Kit. Would there be any major modifications/changes that would be required?
09/04/2008 (9:14 pm)
Is this resource fairly up to date, For example... Does it work with the latest version of TGE?Would there be a problem with me releasing my game (Commercial) with PhysX?
Im looking to port this/implement this in to the RTS Starter Kit. Would there be any major modifications/changes that would be required?
#251
The error appears alike so,
You do not have the correct version of the FPS Starter Kit or the related art needed
to play on this server, please contact the server operator for more information.
(Invalid packet GameBase::UnpackUpdate())
Any help would be wonderfull...
Thanks,
Daniel
09/05/2008 (1:26 am)
Right, Ive followed the tutorial. It compiled with no errors, Now.. I go to run the game and the mission wont start due to a problem about "Wrong version".The error appears alike so,
You do not have the correct version of the FPS Starter Kit or the related art needed
to play on this server, please contact the server operator for more information.
(Invalid packet GameBase::UnpackUpdate())
Any help would be wonderfull...
Thanks,
Daniel
#252
10/08/2008 (1:57 pm)
Just a quick question I am running an ATI radeon HD 3650. When I run my app I get an error stating that I am missing nvCuda.dll. I did a little searching but I'm not sure if PhysX will work on ATI cards. Could anyone let me know if any version of PhysX will work on ATI cards or even integrated cards by chance?
#253
10/08/2008 (2:00 pm)
Did you follow Brady's steps and use version 2.6.4?
#254
With 2.6.4 does the current distribution. i.e. "Free" still apply as it does with the latest version of PhysX?
10/09/2008 (6:52 am)
I did follow the steps but I was hoping I could get the latest version on PhysX working. I just downloaded 2.6.4 and atleast the PhysX Demo's run on my Card now. Recompiling now and I will see if my app works.With 2.6.4 does the current distribution. i.e. "Free" still apply as it does with the latest version of PhysX?
#255
10/09/2008 (7:01 am)
Ok! My app runs... Thats the good news, the bad news is that when a box collides in the world my app crashes... The funny thing is that spheres work just fine. Will look further in and be back with more.
#256
10/09/2008 (7:04 am)
Is this with the newest version or 2.6.4?
#257
10/09/2008 (7:31 am)
I'm pretty busy with other things at the moment so I wish I could help you in more detail, but I was just going to drop you a note that according to my subsequent tests, the latest build of PhysX does work with this resource. However, you may prefer to use the older one because the redistro for it is a lot smaller. This may not be an issue for you, but if you're going to distribute your game electronically, you'll want to keep file sizes down.
#258
When I drop a box in all is well but as soon as it collides with the terrain I crash. Box's work fine on my interiors and the player can kick them around but as soon as they hit the terrain... Boom!
10/09/2008 (7:49 am)
Having the problems with 2.6.4. When I use the latest PhysX SDK I get the can't find nvCuda.dll error. I tried downloading the Cuda SDK from Nvidia but I guess I need a Nvidia card to actually install the drivers which is where the nvCuda.dll is from what I can tell.When I drop a box in all is well but as soon as it collides with the terrain I crash. Box's work fine on my interiors and the player can kick them around but as soon as they hit the terrain... Boom!
#259
if (!mActor->actor->isSleeping())
{
setMaskBits(PositionMask); <---- This is where I get an error.
isCollided = false;
}
The setMaskBits throws an AssertFatal Call "Object with zero mask already in list.".
Any Idea's out there?
Mod:::
Actually the AssertFatal is a few lines about the aformentioned Assert it's AssertFatal "Invalid net mask bits set.".
I had commented it before trying to figure out what is wrong.
10/09/2008 (12:17 pm)
Hmmm I've tracked it down to this section of code.if (!mActor->actor->isSleeping())
{
setMaskBits(PositionMask); <---- This is where I get an error.
isCollided = false;
}
The setMaskBits throws an AssertFatal Call "Object with zero mask already in list.".
Any Idea's out there?
Mod:::
Actually the AssertFatal is a few lines about the aformentioned Assert it's AssertFatal "Invalid net mask bits set.".
I had commented it before trying to figure out what is wrong.
#260
I commented out all the calls to setMaskBits(PositionMask) in PhysXActor.cpp. Now it seems to work but I'm sure that because of my hachet work the Actor will not be updated on the network.... For now I can play with bouncing boxs atleast.
Can anyone tell me some consequences of my actions? I'm sure there are more than I'm guessing.
10/09/2008 (2:01 pm)
Ok I grew tired and decided to just start choping away and see what happens.I commented out all the calls to setMaskBits(PositionMask) in PhysXActor.cpp. Now it seems to work but I'm sure that because of my hachet work the Actor will not be updated on the network.... For now I can play with bouncing boxs atleast.
Can anyone tell me some consequences of my actions? I'm sure there are more than I'm guessing.

Esat Bayol
1>------ Build started: Project: Torque Demo, Configuration: Debug Win32 ------
1>Linking...
1>player.obj : error LNK2019: unresolved external symbol "public: struct sNxActor * __thiscall PhysXWorld::AddShapeBase(class ShapeBase *)" (?AddShapeBase@PhysXWorld@@QAEPAUsNxActor@@PAVShapeBase@@@Z) referenced in function "public: virtual bool __thiscall Player::onAdd(void)" (?onAdd@Player@@UAE_NXZ)
1>player.obj : error LNK2019: unresolved external symbol "public: static class PhysXWorld * __cdecl PhysXWorld::getWorld(bool)" (?getWorld@PhysXWorld@@SAPAV1@_N@Z) referenced in function "public: virtual bool __thiscall Player::onAdd(void)" (?onAdd@Player@@UAE_NXZ)
1>tsStatic.obj : error LNK2001: unresolved external symbol "public: static class PhysXWorld * __cdecl PhysXWorld::getWorld(bool)" (?getWorld@PhysXWorld@@SAPAV1@_N@Z)
1>interiorInstance.obj : error LNK2001: unresolved external symbol "public: static class PhysXWorld * __cdecl PhysXWorld::getWorld(bool)" (?getWorld@PhysXWorld@@SAPAV1@_N@Z)
1>terrData.obj : error LNK2001: unresolved external symbol "public: static class PhysXWorld * __cdecl PhysXWorld::getWorld(bool)" (?getWorld@PhysXWorld@@SAPAV1@_N@Z)
1>tsStatic.obj : error LNK2019: unresolved external symbol "public: void __thiscall PhysXWorld::SetupTSStatic(class TSStatic &)" (?SetupTSStatic@PhysXWorld@@QAEXAAVTSStatic@@@Z) referenced in function "protected: virtual bool __thiscall TSStatic::onAdd(void)" (?onAdd@TSStatic@@MAE_NXZ)
1>interiorInstance.obj : error LNK2019: unresolved external symbol "public: struct sNxActor * __thiscall PhysXWorld::SetupInterior(class InteriorInstance &)" (?SetupInterior@PhysXWorld@@QAEPAUsNxActor@@AAVInteriorInstance@@@Z) referenced in function "protected: virtual bool __thiscall InteriorInstance::onAdd(void)" (?onAdd@InteriorInstance@@MAE_NXZ)
1>terrData.obj : error LNK2019: unresolved external symbol "public: void __thiscall PhysXWorld::SetupTerrainCollision(void)" (?SetupTerrainCollision@PhysXWorld@@QAEXXZ) referenced in function "public: virtual bool __thiscall TerrainBlock::onAdd(void)" (?onAdd@TerrainBlock@@UAE_NXZ)
1>../example/torqueDemo_DEBUG.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Torque\TGE_1_5_2\engine\out.VC8.DEBUG\BuildLog.htm"
1>Torque Demo - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========