I'm working on a script where I need to find all FreeControllerV3 inside a given sphere. I can find the names with the following code
hitCollider.gameObject.name shows common names like "hipControl", "headControl", and so on. Now the problem is how can I cast hitCollider -> FreeControllerV3? No matter whether I try I get a "Cannot implicity convert..." message.
Code:
Collider[] hitColliders = Physics.OverlapSphere(Object.control.position, 0.5f);
foreach (var hitCollider in hitColliders)
{
if(hitCollider.gameObject.name.Contains("Control"))
{
SuperController.LogMessage(hitCollider.gameObject.name);
}
}
hitCollider.gameObject.name shows common names like "hipControl", "headControl", and so on. Now the problem is how can I cast hitCollider -> FreeControllerV3? No matter whether I try I get a "Cannot implicity convert..." message.