I got notified because my thread got linked here.
Hmm how interesting, my first NPCs (where I could have about 1500) those were physics based still, I used humanoids but disabled a lot of states and NPCs that weren’t moving got anchored.
Though, not best method, if you have like 200 of those NPCs walking around at the same time, things like touch events, etc start lagging behind a little and such.
Recently I was going to rewrite NPCs using raycasts instead.
What I basically wanted to do is, 2 raycasts from both shoulders so our custom humanoid doesn’t clip/walk through very thin spaces and 1 raycast downward with of course a check if it’s not too high ground to stand there (we don’t want our humanoid walking up very steep wedges/walls).
Finally to make sure our NPC doesn’t walk into a wall and get stuck/glitch through, if the 2 raycasts from the shoulder hit a wall, always place the humanoid about 2 studs away from the wall by offsetting it.
This is just on the server, also should note that your NPC does not really “move”, it rather teleports over very small distances very quickly (about 4 studs every 0.2 seconds or so, depending on NPC walkspeed).
Now since this is gonna look very choppy, you may want to fully render the NPC on client and do the animations there by checking the X/Z positions and how fast they change/differences between them.
Using TweenService you can tween the client-rendered model to the server position of the NPC, the server version of the NPC will just be an hitbox.
You might want to take ping into mind as well since high ping causes positions to reach the client a little delayed, so if that happens, we slightly slow down the tween so it doesn’t look like as if our NPC stops walking for 1/10 ish second.
This method should work fine, still need to experiment a little myself with how I’m gonna do the raycasts for my custom humanoid but this is how I plan on doing it,
if I got my custom raycast-based humanoid finished I might post like a source code or something so you can see how I have done it.
Hope this helps.