Hi everyone, can a character controller use an if statement to see if it collides with another object or is it not that simple? I know that character controllers and colliders use functions to detect this but I would like a simple if statement to check for a collision if possible.
You can try using Physics.CheckCapsule to do a simple true or false check.
void OnControllerColliderHit (ControllerColliderHit hit)
{
if(hit.gameObject.tag == “playerDoor”)
{
currentDoor = hit.gameObject;
Door (doorOpenSound, true, “dooropen”, currentDoor);
}
}
It’s not “in an if” but there is a nice if inside of it
OnControllerColliderHit only handles Character Controllers I believe.