I noticed in Rust that on a number of occasions I’ve had mobs notice me through walls, and they are also capable of attacking me through obstacles and walls. It’s rather frustrating when I’ve shut myself into my little crappy wood hut at night and all of a sudden a zombie is attacking me through the walls.
I’m pretty sure they are aware of this already, should be fixed as soon as any of the devs has some spare time, just need to add Y position checking when being attacked by an animal
EDIT: Wait, zombie attack you through walls? That’s new, didn’t use to happen.
Zombies, bears, and wolves all have done this do me the last time I played.
From what I’ve seen, this bug has been present for a while. It may not be as simple as ‘if structure between npc and player, negate damage’. It could even be that those checks are coded, but aren’t working properly. Since you can use boxes from outside a structure if it’s close enough and in line of sight, it could be the attack damage works the same way.
would be cool to hear from a dev on the issue
That depends on how their server code works I suppose. If they have access to a physics engine I see no reason they couldn’t just use raycasts for this (if a line cast from the mob to the target hits an obstruction, the mob cannot attack the target). Basically the same code they use for bullets. But without a full physics engine they might have some difficulty with this.
My guess is they use the same method for bullets, opening a box, and melee attacks.
Realistically I think if there’s a wall in between, melee and opening storage shouldn’t work.
as not a game programmer, I think the most efficient solution would be a check for vertical height, and a 2 dimensional (birds eye) check for obstructions using vectors.