[Beginner] How to add a exist entity to NxOgre Scene ?

zhucde

31-08-2009 09:58:45

Create a entity to Ogre scene:

pEnt=m_SceneManager->createEntity("knot","knot.mesh");
m_SceneManager->getRootSceneNode()->createChildSceneNode()->attachObject(pEnt);

then add it to PhysxWorld,
in old version , i do like this ?

ShapeParams shapeParam;
shapeParam.setToDefault();
ShapeBlueprint * blueprint;

ConvexShape * convexshape = new ConvexShape("knot.mesh", shapeParam);
convexshape->mShapeDescription.group = GROUP_COLLIDABLE_PUSHABLE;
blueprint = static_cast<ShapeBlueprint *>(convexshape);

Vector3 scale = pEnt->getParentSceneNode()->_getDerivedScale();
blueprint->mParams.mMeshScale = NxVec3(scale.x, scale.y, scale.z);

NxOgre::Pose pose = NxOgre::Pose(entity->getParentSceneNode()->getPosition(), pEnt->getParentSceneNode()->getOrientation());

ActorParams actorParams;
actorParams.mNodeName = pEnt->getParentSceneNode()->getName();

new Actor(meshName, scene, blueprint, pose, actorParams);



but in Version1.54, how to do ?

is there any way to create a shape from a ogre meshfile? must .nxs ?

spacegaier

31-08-2009 11:49:05

Have a look at the NxOgre BloodyMess tutorials I wrote: NxOgre Portal. It as all explained there.

zhucde

31-08-2009 13:33:08

is it means converting the ogre mesh file to PhysX Mesh (*.nxs) file is necessary ?

is there any other way to create a NxOgre::Shape from a Ogre Mesh file ?

betajaen

31-08-2009 13:39:46

Sadly no, PhysX doesn't know who or what Ogre is. So it's mesh format is meaningless to it.

spacegaier

31-08-2009 13:56:54

Yes, you have to convert the .mesh file of Ogre into a .nxs file (using the tool Flour).

Then it can be used by NxOgre. And then when, creating a new NxOgre::Body, you specifiy both, the .mesh file and the .nxs file.