- Home /
play multiple animations on one object
I made a puzzle that sort of resembles the Skyrim puzzles. The ones where you rotate the outer, middle and inner rings and then insert a claw in the middle. Instead of the claw, I have a sphere in the middle that rotates 180 degrees and a key is inside it. So I'm trying to play multiple animations on one single object with the key "e" (which would be the rings). I have the first animation done and it's playing perfectly, I just don't know how to add the other animations onto the same object. This is my code:
//Master Script
static var isActive : boolean = false;
function Update () {
if(Input.GetKeyDown("e")){
print ("Activate");
isActive = true;
}else {
isActive = false;
}
} //Master Script
//OuterRingScript
var inRange : boolean = false;
var BigRing : GameObject;
var rotateRight : boolean = false;
function Update () {
if ((inRange == true) && (_Master.isActive == true)) {
//if (BigRing == false) {
print("You Rotated Right");
BigRing.animation.Play("RotateO");
rotateRight = true;
//}
}
}
function OnTriggerEnter(OuterRing : Collider){
if (OuterRing.gameObject.tag == "Player"){
print ("Done");
inRange = true;
}
}
function OnTriggerExit (OuterRing : Collider) {
if (OuterRing.gameObject.tag == "Player"){
inRange = false;
}
} //OuterRingScript
I have the animations size set to 4 because there's 4 animations per ring, so that's not the issue. The issue is, I just don't know how to code that second part.
Your answer
Follow this Question
Related Questions
Animation not playing correctly 1 Answer
Animation precision is lost for character's blinking 1 Answer
Problems with an animation 0 Answers
Animation2D help! 1 Answer
Animation Bugging out 2 Answers