- Home /
How to animate a property from current value to a given value?
Hi all, Is it possible to create a Mecanim animation that animates a property from its current value to a given value? Example: I want to create an animation that rotates my camera from its current rotation (it could be any rotation) to rotation (0,0,0). Is it possible? Thank you in advance! :)
hi friend did you slove this issuse? i have same issuse. i want add scale.x a sprite from current scale.x
for my situation , i find a solution add a parent object , children object change scale.x ,parent object change scale.x Too. it is not best ,but simple to work . for example , parent object set scale x to 2, children object have a animation set scale.x in range: 0~0.5 , and finally sprite scale during Animation is 0~1
Answer by Gnorpelzwerg · Dec 28, 2015 at 09:31 AM
Sure, that's possible. Watch the tutorials first, they show everything you'll need,
Id downvote you if I could. Just answer him, not send him the link to every single tutorial on the topic, christ.
Answer by unity-huunity · Dec 28, 2015 at 09:40 AM
I don't think it is good reason to use Mecanim for that propose. Mechanim is just an animation switcher. If you have variables, I mean if you don't really know whats going to happen, like you don't know with what rotations you will work with, it's better to code that parts. Using plugins like iTween can be a great solution.
You could combine code and the animation by animating a public script variable "progress" between one and zero as property. Then interpolate between rotation current (which u save first) and destination rotation by "progress" in the void update( ) function.