as I am making a game with robots that can battle,
and have done the weapons via a raycast (much like “Hello Picking” tutorial), I need to know which part of the robot was hit (arm, leg, center/left/right torso, head) to apply a damage value.
How would I go about finding out which part it is (since it also is a rather complex mesh)?
I should probably also mention that it is bone-animated.
Would the easiest approach be splitting it into multiple meshes and then rather animate them by position, or is there a better thing to do?
Thanks in advance for any answers!
I’d suggest attaching bounding boxes around each part that should take damage, and then checking your ray hits against those boxes. That way you’d immediately know which robot and which body part got hit.
Could you expand on the bounding boxes, please?
Because I can’t think of a way right now that’d make them invisible, but still pick-able.
For example you can add them to the AttachmentNode of the bones so you can have one box per bone which is even animated then.
You can make them invisible by setting their CullHint to Always.
What you might still need though is a modification of Node.collideWith, I copied the code back then and have a method which I can just pass a List (e.g. all bounding boxes).
That way your performance is way better since it doesn’t collide with the high resolution models but only with a few boxes.
I think that’s also the only way it works when you use Hardware Skinning
Thanks a lot,
I’ll give that a go!
That works, thanks!
Marking thread as solved.