Samapico
15-08-2013 15:40:44
I'm using something like this:
It seems that the StaticMeshToShapeConverter combines all the submeshes into a single one. The problem arises later when I launch rays at my object. I get the index of the submesh it hits, and I want to use this to go through the mesh's vertex data and pull out some information like the texture coordinates and the vertex normals. I have to get this data from OGRE directly, so the mesh in OGRE still has multiple submeshes, while the shape in bullet is merged into a single object, so the indices I get from bullet can't be used to get the info from the mesh in OGRE.
I'm guessing there are two ways to go about this:
1) Is it possible to have the StaticMeshToShapeConverter preserve the submeshes in the shape? Does bullet even support sub-shapes? I see how I could create multiple shapes by creating a trimesh for each submesh's vertexdata, but is there any way to keep some kind of relationship between those shapes afterwards?
2) How hard / efficient would it be to transform my mesh and merge all the submeshes in it? It would have to be done dynamically while / after I load the mesh, because I have to support .mesh files on which I have no control. So just converting the .mesh file wouldn't work for me.
Thanks
OgreBulletCollisions::StaticMeshToShapeConverter smtsc(someEntity, transform);
OgreBulletCollisions::CollisionShape* newShape = smtsc.createTrimesh();
Q_ASSERT(newShape);
It seems that the StaticMeshToShapeConverter combines all the submeshes into a single one. The problem arises later when I launch rays at my object. I get the index of the submesh it hits, and I want to use this to go through the mesh's vertex data and pull out some information like the texture coordinates and the vertex normals. I have to get this data from OGRE directly, so the mesh in OGRE still has multiple submeshes, while the shape in bullet is merged into a single object, so the indices I get from bullet can't be used to get the info from the mesh in OGRE.
I'm guessing there are two ways to go about this:
1) Is it possible to have the StaticMeshToShapeConverter preserve the submeshes in the shape? Does bullet even support sub-shapes? I see how I could create multiple shapes by creating a trimesh for each submesh's vertexdata, but is there any way to keep some kind of relationship between those shapes afterwards?
2) How hard / efficient would it be to transform my mesh and merge all the submeshes in it? It would have to be done dynamically while / after I load the mesh, because I have to support .mesh files on which I have no control. So just converting the .mesh file wouldn't work for me.
Thanks