problem loading a physX triangle mesh

lgomide

18-11-2008 12:57:59

I'm trying to load a .nxs file into my NxOgre application, but I get runtime error when I try to use it to specify a shape in the createBody function

first, I converted my ogre mesh with flour:

flour convert in: avatar.mesh, into: skeleton, out: test.nxs

after that, I try to load it in my program



NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://test.nxs","tentativanxs");
NxOgre::TriangleMesh* mTriangleShape = new Ogre::TriangleMesh("tentativa.nxs");

mScene->createBody<NxOgre::Body>("Sphere01.mesh", new NxOgre::Cube(50.0f), Ogre::Vector3(2000, 350, 1700), NxOgre::ActorParams("mass: 5"));



this code is in the createScene method of my ogre app, and I get runtime error in the creteBody line... does someone know what is wrong?

I'm using NxOgre.1.0.22T2 and PhysX SDK 2.8.1. The mesh is a human avatar, about 1.4 MB

sorry for my poor English

lgomide

18-11-2008 13:05:37

sorry, the code is



NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://test.nxs","tentativanxs");
NxOgre::TriangleMesh* mTriangleShape = new NxOgre::TriangleMesh("tentativanxs");


mScene->createBody<NxOgre::Body>("body1; avatar.mesh", mTriangleShape , Ogre::Vector3(2000, 400, 1700), NxOgre::ActorParams("mass: 50"));

lgomide

18-11-2008 13:19:42

and I used flour with the command

flour convert in: avatar.mesh, into: triangle, out: test.nxs

betajaen

18-11-2008 13:26:40

Your using a triangle mesh in a dynamic shape, it has to be static. Remove that mass and replace it with "static: yes".

As your using for an avatar you need something simpler; a convex for example.

lgomide

18-11-2008 13:53:49

Thanks for helping. It worked with a convex.

But I don't know if I it was well explained, my avatar is a whole human body... if I use a convex, the collision detection is a bit poor (the body is with open arms, and spheres collide below the arms, where there's nothing...)... I wanted to use a tringleMesh for more precise collisions, but I get runtime error if I do this (even using "static: yes"), in this line (TriangleMesh::createShape):


mShapeDescription.meshData = mMesh->mTriangleMesh;


Also, my idea was to make the avatar dynamic... is it possible to do it whitout having to use Cubes or Spheres when I create the body? Any tip would help.

sorry for my poor English

betajaen

18-11-2008 13:59:21

You have to do it with cubes/spheres/capsules or convexes. There is no way around it. Usually people use more than one to make up various body parts. Capsules for limbs and torso, and spheres for heads. Cubes for hands and feet.

It's just the way things are.