|
How would i make it so that when i hit a collider, and when im in that certain collider i press the button 'h' The animation starts to go, I did try and write this code myself but it didnt work, This is my code function OnCollitionEnter () { } If anybody could help or point in the right direction that would be great ? Thanks
(comments are locked)
|
|
Fixed i figured it out :D Can you post the final script please?, I have also been faced with this problem before.
Feb 23 '12 at 01:40 PM
MithosAnnar
It is alot like What i wrote i just typed some things wrong, // Attach this script to your object and set IsTrigger under the //box collider :) function OnTriggerEnter(hit : Collider) { }
Feb 23 '12 at 02:01 PM
benjimazza
(comments are locked)
|

You have a small typo in OnCollitionEnter..don't know if it's the same in your code but it should be OnCollisionEnter(). The OnCollisionEnter function will only be triggered that one frame where the collision is first detected i think. Maybe try setting a variable to true or false using the functions OnCollisionEnter() and OnCollisionExit().
Sorry try using the OnCollisionStay() function instead, should check every frame :)