I’ve read up a bit on hitboxes, but am curious to know what others feel would be the best approach to implementing hitboxes for my specific case.
There are some important points worth mentioning about how the NPC system is built in my game.
The NPC’s on the server don’t exist as models, but rather data packets (folders containing a bunch of ObjectVals corresponding to the current animation, sound, CFrame, etc. of the NPC).
The client reads the data packet and renders the NPC. It plays animations and moves the NPC in accordance to the changes detected in the various ObjectVals.
I believe it’s straightforward to detect hits that the player lands on the NPC in this architecture. I intend on using raycasts on the client and firing a remote event to the server to validate hits.
My main concern is finding a performant and non-exploitable method of detecting hits from the NPC to the player. Since there isn’t any physical representation of the NPC on the server, using raycasts isn’t as obvious of an option. There is the possibility of using the client’s physical version of the NPC for raycasting, but this seems easily exploitable.
The only approaches I’ve come up with that won’t compromise how the NPCs are structured are by generating a part on the server and using :GetTouchingParts(), or using Region3s, but I’ve also read how these approaches are not always ideal.
Is there another approach that I might be missing or something I’ve overlooked? Any advice and insight on the topic is welcome!