when switching the shape of a collision object is it necesary to delete the old shape and if so when and how is it safe to do so ?
curently i have the following code used to update the mesh however it never seem to clean the old tri mesh or the old trimesh shape
BuildMesh(); is the code i use to build a tri mesh from a custom irrlicht node
and if i try to keep track of it and manualy delete the old component i get a crash about a pure virtual function call.
btCollisionShape* Shape2 = new btBvhTriangleMeshShape(BuildMesh(static_cast<CTerrain*>(Node)),true,true);
myRigidBody->setCollisionShape(Shape2);
[Design Question] Modeling bases across a solar system
-
- Posts: 77
- Joined: Tue Dec 27, 2011 11:51 am
-
- Posts: 66
- Joined: Sun Jan 30, 2011 8:46 pm
Re: [Design Question] Modeling bases across a solar system
So I guess you were able to fix the linking errors ?
Well for a btBvhTriangleMeshShape, I generally simply add the vetices again and call partialRefitShape() if the vertices are within the older AABB. Or I call refitShape() if not.Check out ConcaveDemo()
I have had issues trying to get rid of the rigid body completely. As far as deleting the collision shape goes, maybe you can try it by first removing the rigid body from the scene and then adding a new collision shape and adding the body back later.

Well for a btBvhTriangleMeshShape, I generally simply add the vetices again and call partialRefitShape() if the vertices are within the older AABB. Or I call refitShape() if not.Check out ConcaveDemo()
I have had issues trying to get rid of the rigid body completely. As far as deleting the collision shape goes, maybe you can try it by first removing the rigid body from the scene and then adding a new collision shape and adding the body back later.
-
- Posts: 77
- Joined: Tue Dec 27, 2011 11:51 am
Re: [Design Question] Modeling bases across a solar system
no sadly i was not able to fix the linking issue i simply roled back to bullet 2.78
also i don't think i can call refit as i'm building a new mesh from scratch when the lod update often it does not even have the same amount of triangle the the previous one did
i also tryed
also i doubt i can remove the body from the world and add it back later in my current configuration that would lock the game for quite some time
an other thing i'm wondering is can we clear the indices and vertices list from a btTriangleMesh or do we need to create a new one every time ?
EDIT:
why in the world is the destructor a virtual type?
i got a code working but how does one get rid of
a btTriangleMesh and a btBvhTriangleMeshShape i mean thier destructors are virtual type so you are just suposed to have them accumulate in a corner of your aplication?
also i don't think i can call refit as i'm building a new mesh from scratch when the lod update often it does not even have the same amount of triangle the the previous one did
i also tryed
Code: Select all
btCollisionShape* Shape2 = new btBvhTriangleMeshShape(BuildMesh(static_cast<CTerrain*>(Node)),true,true);
myRigidBody->setCollisionShape(Shape2);
delete OldShape ;
OldShape= Shape2;
also i doubt i can remove the body from the world and add it back later in my current configuration that would lock the game for quite some time
an other thing i'm wondering is can we clear the indices and vertices list from a btTriangleMesh or do we need to create a new one every time ?
EDIT:
why in the world is the destructor a virtual type?
Code: Select all
virtual ~btBvhTriangleMeshShape();
a btTriangleMesh and a btBvhTriangleMeshShape i mean thier destructors are virtual type so you are just suposed to have them accumulate in a corner of your aplication?
Last edited by Granyte on Fri Jan 13, 2012 12:22 am, edited 1 time in total.
-
- Posts: 77
- Joined: Tue Dec 27, 2011 11:51 am
Re: [Design Question] Modeling bases across a solar system
~can be deleted~
Last edited by Granyte on Fri Jan 13, 2012 12:22 am, edited 1 time in total.
-
- Posts: 77
- Joined: Tue Dec 27, 2011 11:51 am
Re: [Design Question] Modeling bases across a solar system
no answer any one how can btTriangleMesh and btBvhTriangleMeshShape be deleted or completly rebuilt from scratch?
or maybe i misunderstood but how would one refit thier shape if let's say the shape can go from 6k triangle to less then 2k when the lod updates?
and one last question what is the biggest amount of triangle that can be batched in in a single btBvhTriangleMeshShape and keep a resonable speed if if the represented mesh is a curved plane?
or maybe i misunderstood but how would one refit thier shape if let's say the shape can go from 6k triangle to less then 2k when the lod updates?
and one last question what is the biggest amount of triangle that can be batched in in a single btBvhTriangleMeshShape and keep a resonable speed if if the represented mesh is a curved plane?
-
- Posts: 77
- Joined: Tue Dec 27, 2011 11:51 am
Re: [Design Question] Modeling bases across a solar system
i managed to fix this i basicaly needed to remove the body from the world and rebuild it's component
once this is fixed i bump my head in an other problem how many triangle can i batch in a single object and expect a decent frame rate cause right now i drop from 400 fps to 1 just by crossing from 8000 poly to 8001
once this is fixed i bump my head in an other problem how many triangle can i batch in a single object and expect a decent frame rate cause right now i drop from 400 fps to 1 just by crossing from 8000 poly to 8001