[solved] Cloning colShapes

timeflieslikeabanana
Posts: 5
Joined: Sun Oct 27, 2013 10:05 pm

[solved] Cloning colShapes

Post by timeflieslikeabanana »

Hi Everyone,
I need a way to clone an object in the dynamics world. I've got access to the original colShape. I basically need to be able to create/use this to produce a new object in the dynamics world with a new position/velocity. It would be nice to not need to code a different one of these for each type of colShape I'm using, since it would require saving the mesh data for 5 or 6 different collision shapes. When I try to reuse the old colShape, I discover that an assert fails, so I presume there is an active link that requires a unique colShape for each one. I also cannot find a way to clone it directly. I'm thinking the serializer may help? What do you think?

Thanks!
Banana
Last edited by timeflieslikeabanana on Sun Oct 27, 2013 11:05 pm, edited 1 time in total.
Jonathan
Posts: 36
Joined: Sun Feb 10, 2013 6:52 pm

Re: Cloning colShapes

Post by Jonathan »

Multiple rigid bodies should be able to share the same btCollisionShape. I have not found a function for duplicating rigid bodies so you will have to make one yourself.

How are you trying to share collision shapes? It should work if you've followed the code in the wiki/tutorial/demos.
timeflieslikeabanana
Posts: 5
Joined: Sun Oct 27, 2013 10:05 pm

Re: Cloning colShapes

Post by timeflieslikeabanana »

Jonathan wrote:Multiple rigid bodies should be able to share the same btCollisionShape. I have not found a function for duplicating rigid bodies so you will have to make one yourself.

How are you trying to share collision shapes? It should work if you've followed the code in the wiki/tutorial/demos.
Right you are! I was adding the original rigid body rather than the modified one to the dynamicsworld.