I would like to know what is the best way of giving more damage to a NPC if i shoot it in the head.A ragdoll could be to heavy.Any sugestions?
Thanks in advance!
Hi,There's a bunch of ways to approach this and you'll have to pick the one that works best for you.
You could try using a phantom or a trigger volume.A phantom is basically just an aabb that you'd place at your NPC's head position, then you can say do a raycast against it to simulate the path of a bullet, or test whether objects have collidied with it.A trigger volume is roughly similar but lets you use any shape not just an aabb.Check out the Physics/UseCase/TriggerVolume and Physics/Api/Dynamics/Phantoms demos.
Alternatively, you could just do an asynchronous shape query. This is a one-off collision/casting query on an arbitrary shape, so you'd set up your 'head' shape yourself and then query whether a 'bullet ray' is passing through it, or any objects in the world have collided with it.See the Physics/Api/Collide/AsynchronousQueries/ demos.
Thanks for your quick reply.What do you mean by Set up the head?
All I mean is to place your 'head' shape at the appropriate world position that represents the NPC head when doing the collision or raycasting query.
Ah ok mate.
Thank youvery much!