Two-hand weapon for character

How attach one weapon model like musket or big sword to character (2 position for hands) ?

myCharacterNode.attachChild(myWeapon);

My character has skeleton. I need to attach item to him hands. I found SkeletonControl.getAttachmentsNode but my weapon model is only one geometry. I can attach it to one hand. How attach other point on weapon to second hand ?

You can’t.

Ok, i’ll explain a bit : the attachement thing is like a tree. A leaf is only attached to one bough (not sure of that word), and a bough is only attached to one trunk. And this is normal.

Think about what “A is attached to B” means. It means that when B move (turn etc), A will follow B (will be translated etc).

So, A can’t be attached to B and, say, C, cause then it should “follow” 2 different items and it’s not possible (if the 2 items go in 2 different directions for exemple).

Understand this : when A is attached to B, A is NOT a constraint for B (i.e. A will NOT influence movements of B), it’s the opposite, B becomes a constraint for A

If you want to have a character that hold a two handed weapon, you must do just that same thing that you have to do for a one handed weapon : create a specific animation set for this. There will be no magic, the engine will not understand that your model is a human being and that your musket is hold like this or that, that you run with it like this etc. That’s something NOT deductible from the model, so you have to do it yourself.

Maybe i can attach weapon to one hand and set local position of second hand bone to my point on weapon and updating that position when first hand moved or maybe bullet joints do this for me?

i don’t think that you can modify the position of a sup-spatial during animation (the animation will overwrite your changements). Even if you can, then only the hand will be attached to the sword, the arm will not come with it.

Either the join “hand-arm” or the join “hand-weapon” will break.
You can test, but you’ll find quickly that a two-hand movement is not something physically deductible (maybe that word is wrong. understand it as “derivable” or “deducable”) from a one-hand movement. It exactly the same thing as saying “hey, i want to make my character walk by moving alternatively his feet”. It doesn’t work that way, the rest of the body will not guess from some magic stuff how it should behaves)

What I do is to attach the sword in to the right hand bone attachementNode, then I make sure the left hand follows the right one when I create the animation in blender. And it works pretty well.

yeah, i agree with you, you can do a lot of tricks like that when you create the animation. But

  1. it’s still just a trick, and i think that you doesn’t get realistic animations with that (except maybe for animations where the body is symetric)
  2. you don’t do that during runtime with physics constraints, as you would get often wrong results and you would overload the cpu (or ppu) for nothing.

The “easiest” way to create animations (but the most expensive) is to do motion capture. The initial investement is huge (and i think that nobody can afford it, only big studios) but it seems pretty easy to use after that.

my character is simply like steve from Minecraft :slight_smile:

Maybe i can attach to hands bones attachmentsNode other node with physic joint and attach that joint to points of my item. Joints can keep good distance when bones are moved

what happens if your charater does an animation that doesnt maintain the looks of holding with both hands though? (eg their hands by their side/idle). theres no way to do this without creating animations for two handed items anyway.

id stop over thinking it, and keep in mind that the game is an illusion, not a scientific simulation.

my character has small block as hand I only need attach point to point item. Character can rotate around and not up and down with weapon only changing item need do work.

Attach the weapon to the attachment node for one hand. Attach a random node to the other. Have a control that rotates the weapon to reach the other node (read the spatial.getWorldTranslation()).

@Mararok said: my character is simply like steve from Minecraft :)
@Mararok said: my character has small block as hand I only need attach point to point item. Character can rotate around and not up and down with weapon only changing item need do work.
@bubuche said: yeah, i agree with you, you can do a lot of tricks like that when you create the animation. But 1) it's still just a trick, and i think that you doesn't get realistic animations with that (except maybe for animations where the body is symetric) 2) you don't do that during runtime with physics constraints, as you would get often wrong results and you would overload the cpu (or ppu) for nothing.

The “easiest” way to create animations (but the most expensive) is to do motion capture. The initial investement is huge (and i think that nobody can afford it, only big studios) but it seems pretty easy to use after that.


I don’t think the op’s main goal is accurate simulation. I think you are over thinking this.