I’m trying to create a little 3D game where I need to detect when I have a collision from an object on a part of the body of a character. I’ve followed the [tutorial][1] here so I’ve got a character that moves properly. Though, they don’t talk about hitboxes.
If I’m not wrong, my character doesn’t have any hitboxes (or is the capsule thing a hitbox?). How do I add some ? And even if the capsule is a hitbox, I need a hitbox for each part of the body (to be able to detect hits to the head, legs, arms…), so I need to add some but I also need them to be synced with the corresponding part of the body.
It may be a totally stupid question but I didn’t find anything in the documentation about this… so if someone has an explanation or a link to a tutorial about this, it’d be great.
You can add additional collision components and attach them to say the head and then each can have a separate collision event such as a headshot event etc. You can add them from the Add Component drop down and then attach them, size them etc. Like this:
But if I try to make it smaller it turns into a plane and not a volumic shape… And am I supposed to add the hitbox in the character class or in the mesh asset ?
Thanks for this it might be useful. Though, why would I do this rather than process the hitbox of the head in the character class? It seems more coherent to do it my way, am I wrong ? (I probably am).
No unicorn is suggesting it weirdly, you would want to process the hit on the head in the characterBP…try using a capsule collision that is what I used in that screenshot.
That’s what I did indeed but I wanted it to fit the head, so I reduced the size and the scale is really small and it’s still not matching the size… And how to I do to make it move synced with the head, since it’s linked to the mesh and not the head?
Look at the screenshot I sent…just below where the scale settings are you should see a Sockets area if you attached it to the mesh that is where you attach it to the head, click on the magnifying glass icon to pull up the list of bones then scroll down to head and select it…then you will have to re-position it…it will be faster to set its location to 0,0,0 once you attach it to the head and then move it around to the right position.
Oooooh… yes indeed it’s way better now… Thank you very much it’s awesome. Now there’s only the “coding” part left but I should be able to handle this. Thank you again.