Attaching a body to a character

mnm23

07-09-2006 15:17:48

Hey guys, hows it going. Im having some trouble attaching a body (weapon) to my character. I create the body and then try to access its entity and attach it but it says entity already attached (obviously it would be the way the bp.character is set up). Anyways so i detach the entity and reattach it the character. Now this works for the sceneNode. The sceneNode(weapon) attaches to character but the body still does not. Is there something im missing. Ive tried going through the actor through just the body, but no others have an attach option. I even tried to get the bone position of the character and set the body to this but that didnt work either. Thanks again for all the help.

betajaen

07-09-2006 15:59:29

First is it being a body needed?. If the weapon is a gun for example, there isn't much point; a sword however is your call.

There are a two ways I can think of this:

1. Using a fix joint between the weapon and the character
2. Or using this code snippet to make the weapon "hover" in front of the character, the weapon would just be a scenenode/entity with no physics though.

I'd do number two myself, as I know it does work.

mnm23

07-09-2006 16:07:19

Hey betajaen, Im already doing number two. My problem with it is the lack of collision it offers. Now i havent tried it but im assuming since there will be no bounding box i cant collide with the other characters.

mnm23

07-09-2006 16:08:22

How would i tie a fixed joint in there so the bouding box is always at the position of that bone.

betajaen

07-09-2006 17:17:01

You'd have to create a body in the shape of the bone to tie it down to, so your back to square one again attaching that body to something.

However, you could create a joint to the mActor of the controller but the joint would be in the location of the bone, that would probably work.

mnm23

07-09-2006 19:12:51

Ok i am unable to create a joint through the main character.

max->getCharacter()->mController->getActor()


max is my character i create. It is unable to bring up any joint i have tried many different variations. None bring up a joint.

betajaen

07-09-2006 20:33:44

As in the joint can't be created or the code won't compile?

mnm23

08-09-2006 23:59:32

Sorry for taking a while to get back. No there is no joint that comes up through the actor. Also i have tired creating a dummy body attached as a child of the player and creating a joint between that and the weapon body. This did not work either.

mnm23

11-09-2006 04:45:32

IM still having a problem with attaching a body (my weapon) to the character class (player). Does anyone have a sloution i have tried yet.