addshape can't work?

njw1985

20-06-2008 16:59:54

NxOgre::ShapeParams ss;
ss.setToDefault();
ss.mMeshScale.setx(10);
ss.mMeshScale.sety(10);
ss.mMeshScale.setz(10);
ss.mMass=10;
ss.mSkinWidth=5;
ss.mFlags |= NX_SF_VISUALIZATION;

bike = mScene->createBody("bike;bike.mesh",new NxOgre::CubeShape(3,0.05,6),pose, params_bike);
body_people=bike->addShape(new NxOgre::TriangleMeshShape("peopleb.mesh",ss));

////////////////////////////////////////////////////////////////////////

I set up bike in the ogre with nxogre of version 0.9,and I want to add a people on the bike use body function "addshape",but the result is the people can't display,what is the matter?

betajaen

20-06-2008 17:13:35

First; You can't use TriangleMeshes in dynamic actors. Second; I'm pretty sure the addShape code doesn't work in 0.9, or only written for the primitives.

As for your question: Your adding a physical mesh to the bike, not something rendered. Go add an entity to the node.

njw1985

20-06-2008 17:25:55

thanks for your quick answer!

but as you said "Your adding a physical mesh to the bike, not something rendered. Go add an entity to the node", I don't really understand your mean,,could you give me a little simple code?

betajaen

20-06-2008 17:33:37

Your adding something to PhysX, not to Ogre.


Go look up adding an entity to a scenenode, if you don't know how to do this then you shouldn't be using NxOgre.

njw1985

20-06-2008 17:36:58

I know,,thx,,I will try!!

njw1985

20-06-2008 17:56:35

I do like this:

Entity *ent=ogremgr->createEntity("pp","peopleb.mesh");
bike->getNode()->attachObject(ent);

but peopleb.mesh cant collide with other body?

betajaen

20-06-2008 18:10:35

You use it with the code you posted above. But use a convex mesh instead of a triangle.

njw1985

20-06-2008 18:18:47

the result is the same to use TriangleMeshShape !? the people.mesh can't
display?

betajaen

20-06-2008 18:40:38

Le sigh:

NxOgre::ShapeParams ss;
ss.setToDefault();
ss.mMeshScale.setx(10);
ss.mMeshScale.sety(10);
ss.mMeshScale.setz(10);
ss.mMass=10;
ss.mSkinWidth=5;
ss.mFlags |= NX_SF_VISUALIZATION;

bike = mScene->createBody("bike;bike.mesh",new NxOgre::CubeShape(3,0.05,6),pose, params_bike);
bike->addShape(new NxOgre::ConvexMeshShape("peopleb.mesh",ss));

Entity *ent=ogremgr->createEntity("pp","peopleb.mesh");
bike->getNode()->attachObject(ent);

njw1985

20-06-2008 19:16:24

like you said,,and I do,,I try to set the "offset" of the ConvexMeshShape,,
the offset parameter is not work?