「Unity/3d/アニメーション」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==人型アセットのDL== #AssetStoreからZonbie(https://assetstore.unity.com/packages/3d/characters/humanoids/zombie-30232?locale=ja-JP)をダウンロード #それ...」) |
(→人型アセットのDL) |
||
| 行6: | 行6: | ||
#例として、ZonbieAnimatorControllerとして作成 | #例として、ZonbieAnimatorControllerとして作成 | ||
#Zonbie1のanimetorにPrefubのAnimattionsのZonbie~を全てZonbieAnimatorController上へドラッグして入れる | #Zonbie1のanimetorにPrefubのAnimattionsのZonbie~を全てZonbieAnimatorController上へドラッグして入れる | ||
| − | # | + | #defaultをZ_Idolを設定 |
| + | #parameterにfloatのSpeedを設定する | ||
| + | #Z_IdolでMakeTransitionからZ_WalkへSpeed>0.1で設定する | ||
#zonbieオブジェクトに以下csをアタッチする | #zonbieオブジェクトに以下csをアタッチする | ||
2020年6月6日 (土) 04:41時点における版
人型アセットのDL
- AssetStoreからZonbie(https://assetstore.unity.com/packages/3d/characters/humanoids/zombie-30232?locale=ja-JP)をダウンロード
- それをimport
- PrefubからZonbie1をヒエラルキーにドラッグ
- Assetsの下にAnimetionsのdirを作成しCreate/AnimatorControllerを作成
- 例として、ZonbieAnimatorControllerとして作成
- Zonbie1のanimetorにPrefubのAnimattionsのZonbie~を全てZonbieAnimatorController上へドラッグして入れる
- defaultをZ_Idolを設定
- parameterにfloatのSpeedを設定する
- Z_IdolでMakeTransitionからZ_WalkへSpeed>0.1で設定する
- zonbieオブジェクトに以下csをアタッチする
ZonbieController.cs
using UnityEngine.AI;
[RequireComponent(typeof(Animator))]
public class EnemyController : MonoBehaviour
{
Animator animator;
void Start()
{
animator = GetComponent<Animator>();
}
void Update()
{
animator.SetFloat("Speed", 0.2f, 0.1f, Time.deltaTime);
}
}
参考:https://unity.moon-bear.com/zombie-slayer/enemy-animation/
