Hi, I'm using Physics.SphereCast to detect remote players but they don't get detected all the time. Physics.SphereCast(transform.position, 20, transform.forward, hit, 1); Sometimes when a player come close it doesn't detect it. Is this normal ? Thanks.
First of all, to resolve any confusion, Physics.SphereCast is part of the new Unity 3.0 scripting API.
Are you using proper layers to distinguish between the own player and other player objects, and other colliders? Have you tried Physics.SphereCastAll()?
Also, what strikes me as odd is that you spherecast with a 20 unit radius (40 unit diameter) sphere only 1 unit in front of the player. Possibly this extreme usage could uncover a bug in the implementation? Have you tried if something more sane (like radius 10, 20 units away) gives the same flaky behaviour? Otherwise, you can try using Physics.OverlapSphere instead, which is very similar to what you are currently doing.