I have two objects, one is animated by keyframes, the second is a stationary object in the path of the first. Ultimately, I would like to affect the animation speed (or other parameters) of the first object when it enters the second object.
I set the second object as Is Trigger and attached the following script to object one:
function OnTriggerEnter(collision : Collider)
{
if(collision.gameObject.tag == "cube_col")
{
print("trigger collision");
}
}
The animation is run in the Update function of the script (also tried just running it automatically).
The second object has a tag of “cube_col”, I also tried using the name of the object too, but this didn’t work either.
What am I doing wrong? Is what I’m trying to do even possible?
thanks.
Thankyou, that did the trick, added a rigid body to the first object and all worked fine (after adjusting the layering). thanks again.
– davo007