Is there any way to implement realistic hitbox?

Hello,

Using Capsule collider as hitbox is way more Inaccurate while shooting…

Is there any way to implement hitbox like this which will animated according to the animation of character…

Maybe using a compound collider and binding the individual sub-colliders to the bones of your rig would work. I’m not sure if the compound colloder updates it shape at runtime though.

maybe make separate collision entities for every part and then make it a Child of the bone you want to animate it with

Colliders don’t move when the animation is playing. I tried compound colliders in one of my games and got several issues so i will not recommend compound colliders.
I guess bone position changes in animation so you can play with bones to get somewhere. :slight_smile:

There’s a demo I can no longer find where the developer moved the colliders every frame to match the rotation and position of the bones and that would be the route I would go down.

What issues did you run into for compound physics?

It doesn’t detect collisions most of the time. I was making a bowling game back in April and when i applied compound colliders to the bowling pins it never detect anyone so i have changed them back to a single capsule collider.

It would be great if you can repro the issue :slight_smile: At a guess, it may be because the collision parts being smaller and having a fast moving object. Was CCD enabled?

1 Like

I don’t remember about CCD now but i will try to replicate that issue.

I tried something odd with ragdoll Code.

image

I think hit box can be added but they are getting placed on bone.

So According current bone and next/previous bone we may need to calculate gap and adjust the collider Box.

Will experiment something in free time…

Looks like you will need to use a parent/child pattern to offset where the collider should be in relation to the bone/node.