Is the reason we divide viewingRadius by 2 for the capsule collider's radius because the enemy object is scaled to (2,2,2)?
Referring to this line:
Honestly it's been a while since I looked at the code so I can't say for sure, but I believe that was just done to decrease the detection trigger "range".
The viewingRadius used in the video was set to 8, which would result in a fairly large collider making it much easier for the enemy characters to spot the player. Since I'm manually adjusting the collider radius the scale of the player doesn't really matter here.
Note that you don't need to include the collider radius via script, this can all be done manually. I just wanted a way to dynamically resize the collider anytime I changed the viewingRadius.
Here's an example where viewingRadius is manually to 8:
So my theory is that the viewingRadius is affected by scaling up to (2,2,2).
Setting the scale to (4,4,4), we now see the radius of the sphere collider seems to match viewingRadius*4/2, which is 16.
Ah yes you're right, it's been a while since I last looked at that code. Makes sense why I did it that way, I just couldn't remember why.