- Home /
How to Rotate Cube When jump?
Hi All, I want to rotate a cube when i'll jump. What i want is ,i created rotate animation for cube in unity like this (0-180) and (180-360) degrees.The animation has 3 keys obviously. when i press mouse button jump is happen, at that i want to rotate the cube 0-180 degrees animation and land the cube. Again when i click mouse button the 180-360 degrees animation should be apply and again land the cube . I think it make sense to understand. For first time jump 0-180 deg animation should apply ,for second time jump 180-360 deg animation should apply. Thanks
So, what have you tried? Did you at least manage to trigger one animation? Do you have an animator controller with the states and transitions? Do you know how animator and trigger parameters work?
Answer by Inok · Jun 28, 2015 at 07:44 PM
If i undestand right you need system that synchronise start of jump with start of needed animation? Ok first you need to split animation on 2 independent Splitting Animations. Then you build animation state tree with 2 states that contain 2 splitted animations. Add to transition conditions of each transition between 2 states trigger animation parameter then in script where you start jump write: animator.SetTrigger("name of trigger paremeter"); (where "animator" is reference to your animator component instance).
This variant maybe not ideal but can give you idea how it can be achieved.
What i have to do, i have to split animation in to two states? first is 0-180 and 180-360. For first jump i have to call 1st animation state for second second animation state?
Your answer
Follow this Question
Related Questions
Conflicting Animator SetTrigger 0 Answers
Set boolean to false when animation changes? 1 Answer
pause Animation 0 Answers
Is it possible to always make animations play differently? 0 Answers