I have a script here, to trigger an animation via collider. It DID work very well, i tried it at work in our project. Thing is, i'm doing a personal project. And i tried to use the same script on my character, but it doesn't work. It give me the feedback so the script does something. Only thing is, my characters animation doesn't work. Should i post the script here? Or do guyz need some more information first?
* sorry for the mess up!! here is the script*
var target: Transform;
function Start (){
if (target == null && GameObject.FindWithTag("Player"))
target = GameObject.FindWithTag("Player").transform;
collider.isTrigger = true;
}
function OnTriggerEnter() {
if(target.gameObject.tag == "Player" ) {
target.animation.Play("push");
collider.isTrigger = true;
print ( "Touch!");
}
}
function OnTriggerExit() {
if(target.gameObject.tag == "Player" ) {
collider.isTrigger =true;
target.animation.Play("idle");
print ( "Untouch..");
}
}
The more details the better. Assuming that the script is fine I would say your model hasn't been set up correctly or you've missed a step on the script.
– spinaljackWell, i now used a trigger via raycast, and it works. Only problem i got now, is that it triggers as soon as the script starts. But when i turn of the trigger before playing, it doesn't trigger.
– anon47240033Post your scripts
– spinaljackerhm... i'm getting all kinds of weird stuff. The whole thing is script, but i guess the website doesn't see that. you can tell i'm not a coder lol. Sorry for that.
– anon47240033