Attach primitive bodies to bones of a character

Lanowen

15-01-2011 06:34:47

I want to create a more complicated hit detection body for my character, that moves when the character also moves. I don't need any sort of rag doll effect that where collisions and physics also effect the position of the bones. I just need the body to follow the bones like hit-boxes would in a game like Super Smash Bros.

Is there a way that I can attach a OgreNewt::Body to an Ogre::Bone from the skeleton of my character, so that it moves as the bone moves in an efficient manner?

The only way I really had any success was to attach a body to a new node and create a listener for the bone, and have it update the position and orientation of the body when the bone position/orientation updates. But I am thinking there has to be some other way to do it better?

I was trying to read up on joints and whatnot but I didn't get too far.

I tried to search the forums some people were trying to do the same thing but no solutions were really posted. Or maybe I am going about my problem wrong.

I just want to create hit bodies for things like enemies and projectiles and lava or whatever that is more accurate than just doing bounding box detection.

koirat

18-01-2011 16:37:51

I know your pain. All the solutions I have done so far are just "dirty".
What I have ended with is to manually updating this collision bodies (hand, leg head ... bounding primitives) positions/orientations by getting bone world position and orientation. But it's still problematic.

Lanowen

29-01-2011 02:47:30

Yeah, damn. I figure there should be a way to attach it to bone somehow, I've tried attaching it to the bone which inherits from node iirc, but that didn't work.

To bad no one else is posting, some other threads had the same question and found some sort of answer, but no one ever posted their solution...