- Home /
Make a figure move by mouse + walkanimation
Hi. weve got the following problem. In school we are programming a 3D chess game. Now want to select the different pawns in our game an make them move to a new position. While their movement the figure should play an walk animation. That means the figure souldnt "jump" from one point to the other but it should walk while playing the walk animation. By now we dont have the knowledge how to do it.
We hope someone understands the problem and can help. Because my english isnt as good as it should be i have written the text in german, too ;)
Hi. Ich habe folgendes Problem. in der Schule programmieren wir zur zeit ein 3D Schachspiel. wir wollen nun die einzelnen Figuren mit der Maus anwhlen und diese dann zu einer neuen position bewegen knnen. bei dieser Bewegung soll eine Laufanimation abgespielt werden, d.h. sie soll nicht von der einen zur anderen position "springen", sondern laufen. leider haben wir keine Ahnung wie wir das anstellen sollen. Hoffe auf eine schnelle hilfe.
Answer by Alec-Slayden · Jul 18, 2011 at 11:56 PM
Consider using Smoothdamp, or Vector3.Lerp. These functions will allow you to interpolate between 2 points at a rate you specify, so your object will smoothly move to its destination.
Assuming you want this move action to take place as a separate function, you might need to use a while
loop. just be sure to add yield
in that loop, so the changes will be applied each frame.
All of the above assumes you have a fundamental understanding of scripting and basic unity editting like applying animations to objects, etc. If you don't, please consider asking separate specific questions to be resolved.
[3]: http://unity3d.com/support/documentation/ScriptReference/Animation.Play.html
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
How to select keys in the animation editor? 1 Answer
Animation of throw spear 1 Answer
Move to different parts of an animation. 0 Answers