- Home /
Animation problems
Hey all
I'm having problems with getting two animation scripts to work. The first is with a door which I'm trying to get to open when the player walks into it, however it says it cannot find the animation I've made for it. Here is the code:
var doorOpenSound : AudioClip;
function Update () {
}
function OnControllerColliderHit (hit : ControllerColliderHit) {
if(hit.gameObject.tag == "Door") {
Debug.Log("Hello");
var door : GameObject = hit.gameObject;
OpenDoor(door);
}
}
function OpenDoor(door: GameObject) {
audio.PlayOneShot(doorOpenSound);
door.animation.Play("opendoor");
}
the second is to make a skeleton rise from the ground but the script says it doesn't know what hit is. Script is:
function OnTriggerEnter (play : Animation){
if (hit.gameObject.tag == "skeletonrise") {
Debug.Log("Hello");
animation.Play("skeletonriseani");
}
}
Any help would be great. Thanks.
Have you definitely attached the animationclips with those names to your object? If you've added in the clips after adding the script, they won't automatically update, you need to add the clips to the animation component manually.
Answer by ocularcash · Nov 10, 2011 at 06:28 AM
Besides these it looks fine
if(hit.gameObject.tag == ("Door"))
if(hit.gameObject.tag == ("skeletonrise"))
those are in the script as they refernece a trigger which the player uses to activate the animations
Your answer
Follow this Question
Related Questions
So many script problems. Please help, urgent! 2 Answers
Weapon customize system 1 Answer
Using multiple buttons in script 3 Answers
Strange issue changing the animation state 0 Answers
Getting this character controll script working right 1 Answer