There's more...

We've covered hit detection using the Physics.Raycast() method, which is good for targeting body parts or fast moving projectiles. But you can just as easily implement body part detection in melee combat. All you need to do is to implement the void OnCollisionEnter(Collision collision) method in either the BodyPart.cs script or a new script attached to the weapon (it needs to have a Collider and a Rigid Body component set to Is Kinematic). You would then have to check if the entering collision object has a proper script or tag attached to determine whether you hit a body part.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.71.211