Detect a bounding volume colision betwen 2 animated spatials

Hi everybody! Sorry if i dont explains my problem propertly becouse i dont speak english perfectly.

Im making a “Tekken” or “Mortal combat” style game with JMonkey. Ive already implement the characters animation and movement and also the phisics in the scene and it works fine, now my problems is this:

I have two characters, one in front of another, and i controll one of them, when i press a key it makes an animation of a punch.
What i want is a way to detect when the hand of my character intersect with the other character while the animation is played.

I have readed and tried several thing and i think could be done with bounding volumnes aplied to mi character node, but i dont know how to do it.

I think that i can make a bounding volume that fits my character, but i dont know if when i animate it, the bounding volume could work well.

Do yo have any idea of how can i implement this?

How can i detect when my character colisions with the other while its playing an animation?

Its not a phisics collition, its only detecting if one characetr intersects with the other.

Thats for reading! If you dont understand what i want i can try to explain it better.

First, have you read https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics?

Have you considered using a HullCollisionShape or a GImpactCollisionShape? That might be more straightforward than the bounding box.

To continue your current line of thinking, a bounding box would be a BoxCollisionShape. You’d probably want to re-create it on every frame.

1 Like

Haven’t used it yet but the KinematicRagdollControl creates collision shapes around each bone

1 Like

one way to do this is to get attachment nodes from the SkeletonControl (like the arm attachment node) and then add a GhostControl to it (in the shape of the arm). then go throuhg and do this for all the other arm, legs, torso, and head.

the attachment nodes will move with the bones (the animations) and you can detect for specifically the arm is making contact with the enemy etc etc.

1 Like

Thanks to all of you!

@wezrule KniematicRaggdollControll will be a good idea, but i have read that is imposible to get a collision “Ragdoll” vs “Ragdoll” so I think i will try with the idea of @icamefromspace, SkeletonControl and the GhostControl, i’ll tell you how it goes!

Thanks to all!

Hi everybody again, so i think that this is the idea:

    Node HandNode = model1.getControl(SkeletonControl.class).getAttachmentsNode("Hand.R");
    GhostControl ghost = new GhostControl(new HullCollisionShape());  
    HandNode.addControl(ghost);

So my doubt now is how do i now what is the exact shape of my HandNode to apply it to my GhostControl.

In this case i have used HullCollisionShape, but what kind of Shape should i use?

when i said in the shape of the hand/arm i was thinking more along the lines of a box or a sphere that approximates its shape. .

the attachment node itself doesnt contain any geometry, so you wont be able to generate a phsyics object from the node. you’ll have to “free hand” the physics shapes.

you’ll probably only want a box anyway for performance reasons.

I tried to use mugen some time ago, and even if it’s a 2D game (and not a 3d one) there is still interesting things to learn from it. And one things is : the hit detection is not a “pixel overlapping” test (which is more or less the equivalent to your mesh accurate test), it’s only rectangles. You define rectangles for collision each frame (they can be the same, of course), and rectangles for hit. This is because someone can have a trench coat or something equivalent and then a part of its model (pixel for 2d, mesh for 3D) is not a damageable part.
You talk about tekken (and the third is one of my favourite game ever, i spent literraly thousands of hours on it), and in tekken you have some “special effect” when you hit someone. These effects are here for a reason : they “hide” the fact that characters may not have physic contact;

You really should read some tuto about mugen (even if you don’t create a character on it), it’s full of interesting informations and have some good approach.