I cannot get these two scripts to work together correctly. I have this first script attached to a game object with the collider turned off.
var stumpColliderEnable;
function Start ()
{
ColliderState();
}
function ColliderState()
{
collider.enabled = stumpColliderEnable;
//stumpColliderEnable = false;
}
And this second one on my player.
var treeStumpCollider : TreeStump;
//var treeChunkCollider : TreeChunk;
//var treeTrunkCollider : TreeTrunk;
private var theCollider : String;
function OnTriggerEnter (other : Collider)
{
theCollider = other.tag;
if (theCollider == "TreeStump")
{
treeStumpCollider.stumpColliderEnable = true;
}
}
function OnTriggerExit (other : Collider)
{
theCollider = other.tag;
if (theCollider == "TreeStump")
{
treeStumpCollider.stumpColliderEnable = false;
}
}
For some reason the collider will not enable when the object enters the trigger I have on my player. I have a capsule collider attached to my player set to trigger as well as a rigidbody. Any ideas as to what I might be doing wrong are greatly appreciated.