zhucde
03-09-2009 10:38:43
NxOgre::Mesh* triangleMesh = NxOgre::MeshManager::getSingleton()->load("media:knot.nxs");
NxOgre::TriangleGeometry* triangleGeometry = new NxOgre::TriangleGeometry(triangleMesh);
mScene->createSceneGeometry(triangleGeometry, NxOgre::Matrix44(NxOgre::Real3(0, 115, 0)));
after the SceneGeometry created, can we transform it ? move/ rotate ?
betajaen
03-09-2009 10:47:41
Nope. You can't move, rotate or even delete it after it's been created. It's Static - never changes.
spacegaier
03-09-2009 11:00:17
Why can't you even delete it?
betajaen
03-09-2009 11:22:11
PhysX makes some optimisations based on your Scene. It assumes that the static geometry will never move. For example; Deleting a static geometry with a stack of boxes underneath should leave the boxes still in the air - because it assumes it will never go, so there is no need to check for it.
I'm sure all the big games using PhysX go through tens perhaps hundreds of Scene creation/destruction in a typical gaming session. Creating/Deleting a scene isn't a big deal. All the meshes/heightfields are stored in the World so all you have to re-create the actors. If your just changing levels then it isn't much of a problem.
betajaen
03-09-2009 11:24:05
PhysX makes some optimisations based on your Scene. It assumes that the static geometry will never move. For example; Deleting a static geometry with a stack of boxes underneath should leave the boxes still in the air - because it assumes it will never go, so there is no need to check for it.
I'm sure all the big games using PhysX go through tens perhaps hundreds of Scene creation/destruction in a typical gaming session. Creating/Deleting a scene isn't a big deal. All the meshes/heightfields are stored in the World so all you have to re-create the actors. If your just changing levels then it isn't much of a problem.
This is the manual entry of Static Actors/SceneGeometries
Once the static actor is created, do not do anything with it. Even though operations such as changing the position, adding more shapes, or even deleting the static actor are not explicitly forbidden, they are not recommended for two reasons: 1) the SDK assumes that static actors are indeed static, and does all sorts of optimizations that rely on this property. Changing the static actor may force time consuming re-computation of such data structures, and 2) the code driving dynamic actors and joints is written with the assumption that static actors will not move or be deleted for the duration of the simulation, which permits a number of optimizations for this very common scenario. For example, moving a static actor out from under a stack of sleeping boxes will not wake these up, thus they will levitate in midair. Even if they are woken up, the collision response between moving static and dynamic actors is of low quality.
In NxOgre I take these recommendations as the truth and don't provide move functions or delete functions for StaticGeometries. Even if you wanted to delete or move them - you can't.