Hello there!
I’m currently working on a satire survival game and I’m currently wondering how I can make NPC’s attack players within its range? Would I use Magnitude, hitboxes, etc for it?
Hello there!
I’m currently working on a satire survival game and I’m currently wondering how I can make NPC’s attack players within its range? Would I use Magnitude, hitboxes, etc for it?
Maths is normally the best way to do stuff, check out docs for Vector3 Magnitude
Wouldn’t that be able to also attack players indirectly? For example, if two players are within a killer’s range and the second player is behind the killer, wouldn’t the player be damaged as well?
You could incorporate a raycast when you’ve got the vector to check for any obstacles
yes, it would damage players behind the killer.
i recommend using a dot product if you intend for the killer to have a “field of view”
this video explains it pretty well:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.