How to trigger a trigger by script

Hey I was wondering if there was anyway to trigger a trigger able box collider form script.

@thekill473

I suppose what you could do is make a function that does what you want to do in the trigger… for instance,

function OnTriggerEnter (hit : Collider)
{
   DoStuffs();
}

function DoStuffs()
{
   if (doSomething)
   {
      // do something;
   }
}

That way, you can call DoStuffs() whenever you want.

-S

Or you could just make the OnTriggerEnter function public and call it directly, passing in null or an existing collider reference.

public void OnTriggerEnter ( Collider collider )
{
   // bla
}

public void WhateverFunction ()
{
   OnTriggerEnter ( null );
}

This would also work if it were private and called from within the same class.