Hi, I use the Third Person Controller package. And I want to activate or deactivate a series of colliders when my character is running. Please help.
Do a Simple Array of Colliders Like This
public bool deactive;
public Collider[] ColliderToDeatctivate;
void Update(){
if(deactive)
for(int i=0; i < ColliderToDeatctivate.Length; i++)
{
ColliderToDeatctivate*.enabled = false;*
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CollideScript : MonoBehaviour
{
public MeshCollider col;
// Update is called once per frame
void Update()
{
if (Input.GetKey("w"))//You press this when the character is moving
col.enabled = true;//Making the collider active
else//when you are not pressing w
col.enabled = false;//disabling the collider
}
}