すみません、質問させてください。
ある3Dキャラをジャンプさせようと思います。
それで以下のスクリプトを書きました。
c#
1 2void Update () { 3 4 //回転と移動 5 Vector3 direction = new Vector3(Input.GetAxis("Horizontal"), 0, 0); 6 if (direction.sqrMagnitude > 0.01f) { 7 Vector3 forward = Vector3.Slerp( 8 transform.forward, direction, rotationSpeed * Time.deltaTime / Vector3.Angle(transform.forward, direction)); 9 transform.LookAt(transform.position + forward); 10 } 11 characterController.Move(direction * Speed * Time.deltaTime); 12 13 //移動アニメ 14 if (Input.GetAxis("Horizontal")!=0) 15 { 16 anim.SetBool("Run", true); 17 Debug.Log("移動してるよ"); 18 } 19 else if (Input.GetAxis("Horizontal") == 0) 20 { 21 anim.SetBool("Run", false); 22 Debug.Log("移動してないよ"); 23 } 24 //攻撃アニメ 25 if (Input.GetKeyDown(KeyCode.Space) ) 26 { 27 anim.SetBool("Attack", true); 28 Debug.Log("攻撃したよ"); 29 } 30 else 31 { 32 anim.SetBool("Attack", false); 33 Debug.Log("攻撃終わったよ"); 34 } 35 //Jump 36 if (Input.GetKeyDown(KeyCode.UpArrow)) 37 { 38 Debug.Log("じゃんぷしたよ"); 39 anim.SetBool("Jump", true); 40 } 41 else 42 { 43 anim.SetBool("Jump", false); 44 Debug.Log("じゃんぷ終わったよ"); 45 } 46 47 } 48
攻撃はうまくできるのですが、Jumpの入力をした際、
アニメーションが一瞬で終わってしまい、ひざがカクってするだけです。
もう少しモーションの発生時間を長くできれば状況が改善すると思うのですが、
どのようにすれば良いのでしょうか?
よろしくおねがいします。
**以下追記
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/07/29 01:51