Hey there,
I am having an awful lot of problems trying to create a trigger that activates an animated hatch door. The idea is that the player having found a ball places it in a hole and a hatch on a boathouse opens dropping down some items for the player to use in the next challenge. I have created an empty game object and ticked the trigger box as well as applied this code to it named doortrigger3.js.
var door : GameObject;
function OnTriggerEnter (collision : Collider)
{
if (collision.gameObject.name == "Ball")
door.animation.Play ("door_01");
}
The animation I created using Unity’s own animation system is definitely names door_01 and the sphere collider object is named Ball yet when I place the sphere into the trigger nothing happens at all. If I check “play animation automatically” before I press play the animation does play fine. I just want it to play when the player does this one simple challenge. I am pretty new to Unity so am probably messing something up somewhere.
I have NO idea where I am going wrong and it is the final piece to my Final MA project which is due in next wednesday.
Any help will be greatly appreciated.