Hello chaps,
I have a trigger box set up (named Trigger Zone 1) and I wish to increase the speed of my player character upon entering the trigger, and every time it does so. So it’s sort of a persistent powerup.
I’m still a scripting noob (Javascript)but I tried attaching this script to my trigger:
var target : Collider;
function OnTriggerEnter (other : Collider) {
rigidbody.AddForce (0, -10, 0);
}
I get an error:
MissingComponentException: There is no 'Rigidbody' attached to the "Trigger Zone 1" game object, but a script is trying to access it.
saying my trigger does not have a rigid.body (which it doesn’t, but I thought I was referencing a rigidbody that enters the trigger, not the trigger itself).
I am obviously doing something fundamentally wrong here. tried searching but just got myself confused.
Any help appreciated.