IrrPhysx 0.2 - Nvidia Physx 2.8.1 wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
yamashi
Posts: 82
Joined: Sat Jan 03, 2009 4:53 am

Post by yamashi »

I have a weird issue.
When I load my terrain tiles, I use 33x33 for each patch, it works well but if I don't face the terrain supposed to load PhysX crashes on "createHeightField()".
I tried to find a problem on my part but couldn't find any :/
If i disable PhysX my app doesn't crash at all.
Also I noticed that if I start the app from VS using the debug tool the problem never occurs...
Could it be a PhysX problem or maybe a bad implementation of PhysX for Windows 7 ?
I tried pretty much everything but I couldn't find a solution :/
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Sounds like the problem some people had with the game example crashing on creation of the heightfield. It appeared to be something bad with the ROUND macro within IrrPhysx... I've not had a chance to look at it myself but you could see if there's anything wrong with that perhaps.
Image Image Image
yamashi
Posts: 82
Joined: Sat Jan 03, 2009 4:53 am

Post by yamashi »

I will take a look, thanks for the tip.

EDIT
It is indeed this ROUND function that crashed the program, so I looked for a ROUND function in the standard library and I was surprisied by the fact that no round function existed.
Then I found that during the cast, the round function is native, so the ROUND macro was useless to begin with, you can chose if you floor or ceil in the compiler options.
EDIT2
The problem still occurs but less often...
Dronchik
Posts: 36
Joined: Sun Feb 17, 2008 1:30 pm
Location: Kazahstan::Astana
Contact:

Post by Dronchik »

Hi gyes! JP, I'm one of admins of russian community of irrPhysX. And we write russian tutorials for IrrPhysX. Now, I want to write articles about using IrrPhysX with irr-files, but I don't know anythink about use Irr-files with IrrPhysX. And my this is my question: How use IrrPhysX with irr-files. If you can make the example project about this, pls, make it and upload it to this topic.
andrei25ni
Posts: 326
Joined: Wed Dec 14, 2005 10:08 pm

Post by andrei25ni »

Hey Dronchik, maybe this helps:

Code: Select all

	

core::array<scene::ISceneNode *> nodes;
smgr->getSceneNodesFromType(scene::ESNT_ANY, nodes); // Find all nodes

	for (u32 i=0; i < nodes.size(); ++i)
	{

		scene::ISceneNode * node = nodes[i];

		switch(node->getType())
		{


        case scene::ESNT_MESH:
        {

			
	    ISceneManager* smgr = device->getSceneManager();
            attribs = device->getFileSystem()->createEmptyAttributes();
            node->serializeAttributes(attribs);
            core::stringc nameXX = attribs->getAttributeAsString("Mesh");
            attribs->drop();
            scene::IMesh* groundMesh = 0;
            groundMesh = smgr->getMesh(nameXX.c_str());

			core::vector3df pos  = node->getPosition();
			core::vector3df rot  = node->getRotation();
			core::vector3df sca  = node->getScale();

			SPhysxAndNodePair* pair = new SPhysxAndNodePair;
			IPhysxMesh* physxMesh = physxManager->createTriangleMesh(groundMesh->getMeshBuffer(0), sca);
			pair->PhysxObject = physxManager->createTriangleMeshObject(physxMesh, pos, rot);
			pair->SceneNode = smgr->addMeshSceneNode(groundMesh, NULL, -1, pos, rot, sca);
			pair->SceneNode->setVisible(false);
			objects.push_back(pair);

		
			}



		

		case scene::ESNT_TERRAIN:
       	{
			physxManager->createHeightfieldObject((scene::ITerrainSceneNode*)node, 0);}
			break;


	

		default:
			
			break;
		}
The code above gets all nodes from an .irr scene, then creates meshes from those nodes and applies collision, then it hides the meshes created by IrrPhysX, so only the initial .irr meshes are shown. This way I can keep the settings made with IrrEdit (transparencies etc.)



Also I'd like to say thanks to JP for making this extension for Irrlicht, it's great!
I'm currently trying to create a vehicle (car type), I'll post the code if I succeed.
Dronchik
Posts: 36
Joined: Sun Feb 17, 2008 1:30 pm
Location: Kazahstan::Astana
Contact:

Post by Dronchik »

andrei25ni, thank you very much! It's just I want))) Спасибо тёзка))) Это то, что я и хотел найти)
deanhanson
Posts: 3
Joined: Thu Sep 17, 2009 6:47 am

Post by deanhanson »

excellent work JP. It's really awesome. This is call a game made by my friend. really nice. By the how much time you spend after this project??
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I look forward to seeing that vehicle support! Certainly something I've thought about myself but never got round to playing with yet, lots of other things on the todo list which I still don't have much time for either!

Dronchik, check out readScene .h & .cpp in the IrrPhysx SDK (probably in the Common folder, under the Examples folder), that's how I handle .irr scenes. Actually that might just be in the Game Example... have a nose around and you'll find it somewhere!
Image Image Image
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

All the examples I can compile but they seem to crash on load.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Have you installed the Physx runtime? If yes and it still crashes then try running a debug version in the debugger to try and find where it crashes, assuming the command prompt log doesn't give any useful info.
Image Image Image
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

I tried running a debug version but it can't load a mesh file if I tried to run it in Visual C++ 2008
mengzhu
Posts: 28
Joined: Fri Jul 17, 2009 7:00 am

Post by mengzhu »

Hello BoingBoing, did you download physx system software 8.06.12(not the newest version)?I solved the running problem this way.
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

I did the setup that came with the file.

Anyways, its just the examples that are broken. When I apply IrrPhysx to my own project it works so must be some weird code in the examples.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

can we get a makefile and a lib for linux please??? (I tried to do it but it was a hell lot of work.
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

Anyone have the ragdolls done yet?
Post Reply