- Home /
Path Trigger Animation
I will get straight to the point.
I got a camera, Tunnels, Objects with different Texturesand GUI Menu.
On the GUI menu question will appear with Answers. When the player has answered a question
a. It will change a texture of an Object or b. it will trigger an animation and translate the camera to a different location.
Question:
How to I set up something like this?
I know its a lot, but any help would help.
THANK YOU ALL UNITY users/:)
Answer by FakeBerenger · Nov 16, 2012 at 02:54 PM
If there is a single path and only one solution to go from one point to another, you can use regular animation. If you can travel from several points at a time, you need 4 animations for each : with ease in/out, in, out or none.
Else, like if you have 4 points A, B, C and D and can do A->B, A->C or A->D (etc), doing animations for each will be very long and, in my opinion, clumsy. You should use waypoints as path. For a simple solution, you can travel linearly between those waypoint. If you have more time, try to implement bezier curves.
ok, I am not sure how to create these curves in unity, i am new to this. What I want to to is. There is 3 points the camera will travel to. A-B, B-C, C-D there will be 3 question given, if player answers all 3 question correctly, the Camera will travel from A-B. if player answers question incorrectly at stage B, the camera will travel back to stage A.
Also when the camera travels to stage B, it will remain there till the player hans answered the questions.
How it makes sense to me is, to create the animations al in $$anonymous$$AYA or unity. a animation that travels from A-B, and a static animation ( Stop) or would that be code ???
what I am trying to say I will have 3 different animations.
I just don't understand how I would set this up >?? HELP NEEDED
Yep, you're on the right track. What you want is simple enough to forget what I said about curves. Let's stick with animations.
Doc for animation : Script and view.
So, first, open the Animation view (view->animation) and select your camera. Create an animation with a clever name (eg : AtoB), create the keys for position and rotation at frame 0, move the timeline to another frame (you can move it later, if you think it's too fast / not fast enough) and move your camera from A to B, and make sure it looks great => Unity will record it. Then do the same for B=>C. Unless you want B=>A to look different, you can just play A=>B backward.
Then, in your script, when the player answer correctly, do this on a script attached to the camera (or elsewhere with a reference on the camera animation's component) :
animation.Play( "AtoB" );
And that's it, no need for a static animation ! $$anonymous$$ake sure your animations wrapmode is set to once though ...
Sweet, What I have done now is:
I have made 6 Animation which are attached to the camera.
Animation AtoB Animation B Static Animation BtoC Animation C Static Animation CtoD Animation D Static
i am guessing in my script I have to:
//Tell the Camera to play "AnimationAtoB" automatically when game starts //When Camera travels to destination B, it will need to trigger "Animation B Static" till the questions are answered and depending on the outcome, it will trigger "Animation BtoC" and the same with the rest.
Is this right ??
Also, how do I play my animation in revers, if i wanted to go back >??