- Home /
Question by
guisauer · Mar 22, 2015 at 05:46 PM ·
animationcontrollerkeyframe
How do I animate a hopping character to fixed distances?
Really basic question here.. I'm trying to animate a 3D character hopping a fixed amount in each direction (Crossy Road style). This is the basic code I have currently:
void Movement(){
if (Input.GetKeyDown(KeyCode.RightArrow)) {transform.Translate(Vector3.right * 1f);}
if (Input.GetKeyDown(KeyCode.LeftArrow)) {transform.Translate(Vector3.left * 1f);}
if (Input.GetKeyDown(KeyCode.UpArrow)) {transform.Translate(Vector3.forward * 1f);}
if (Input.GetKeyDown(KeyCode.DownArrow)) {transform.Translate(Vector3.back * 1f);}
}
Two things I want to work differently:
Currently the character just snaps over, I'd like the transition to last a fixed amount of time (1/4 of a second)
I'd like it to have a hopping keyframed animation during the transition. Can you point me to a good tutorial on how to mix keyframed animation with fixed distance motion?
I don't think I have to using physics for a Crossy Road style game, right?
Thank you su much!
Comment