#How do I calculate the number of raycasts I need for an NPC’s vision system?

1 messages · Page 1 of 1 (latest)

rancid gate
#

I’m making an NPC that detects players using raycasts to simulate visual sight. I’m not sure how to decide how many raycasts are enough for a realistic field of view without hurting performance.

runic skiff
#

damn bro idk

rancid gate
#

"damn bro idk" is the best amount of raycasts

rancid gate
#

this is unity

#

not roblox

#

join @ CAEB

#

idk how many rays I should put in like a 45 degree area to detect the player

rancid gate
#

its not mine I was just giving an example

#

I know how to do it i just dont know how many

#

that might be in the hundreds

#

if I do a hundred raycast every like 0.1 second then thats like a thousand raycast a second

#

with 100 npc thats lie

#

100k raycasts per second

#

yea

#

its check if the player is in the 45 degree area and within a certain range

#

if it is

#

then it raycasts

#

yes

#

this is basically the idea

#

"hearing sight"

#

smh

#

my bad

#

"vision sigh"

#

smh

#

my bad

zinc flax
#

Instead you could make a single raycast fired every .1 secs and each successive ray would be rotated by 1 degree ?

zinc flax
#

👍