0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Unity】移動モーション設定

Last updated at Posted at 2024-07-29

移動させるキャラは、KyleRobotを使用させてもらいました。
以前作成したPlayerControllerに以下のAnimatorにパラメータを入れるコードを追加。

void ApplyAnimatorParameter()
{
    m_Animator.SetFloat( "Speed", m_RigidBody.velocity.magnitude, 0.1f, Time.deltaTime );
}
void Update()
{
    UpdateIsGrounded();
    if( !m_IsGrounded ) return;
    Jump();

    ApplyAnimatorParameter();
}

Animator(Speedの数値によってモーションが切り替わるようになっている)
speed.JPG

実行結果
bandicam-2024-07-29-09-55-22-123.gif

参考にさせていただいたサイト
https://www.youtube.com/watch?v=k-X4bqcc4Mg

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?