I have a door game object. It has a box collider to make the player unable to pass through the door, and a sphere collider to sense the players presence and open the door. It has this script
using UnityEngine;
using System.Collections;
public class DoorOpen : MonoBehaviour
{
private GameObject player;
void Awake()
{
player = GameObject.FindGameObjectWithTag("Player");
}
void OnTriggerEnter (Collider other)
{
if(other.gameObject == player)
{
transform.Rotate(0,90,0);
}
}
}
I have found the possible solution of collider.enable = false;
but i think this will create a problem since I have two colliders. If it helps, the sphere collider is marked as trigger, and the box collider is not. My question, how do I deactivate the sphere collider, without messing with the box collider?