介紹 Animation :(from 126~127)
1. Bone-based animation
2. Sprite-sheet animation
一、 Bone-based animation: 是"一個Sprite",但是各個組件分離,所以可以控制動作。
例如人,手是一個零件,這樣就可以只控制手來做動作。
二、 Sprite-sheet animation:介紹一張圖片,有複數個不同的動作(姿勢)。播放這些姿勢形成完整的動作。
名詞解釋:
1. Animator Component: assigns animations to GameObjects through an Animator Controller.
2. Animator Controller: The arrangement of animations and transitions ( state machine )
2.1 State machine:有不同的 state,例如: walk state ( walk animation. )、Jump state、攻擊 state。
2.2 A transition that says if the player holds down the sprint key, then we transition into the run animation.
How to do transition ? Animation Transition (動作切換)
3. Animation: specific pieces of motion
4. Sprite Renderer: display the 2D sprites on screen.
作法:
(1. ) 分割Sprite。
(2. )
Create an Animator Component
(2. ) create the Animator Controller: In the Project's Assets -> 右鍵 create -> Animator Controller
(3. ) add the Animator Controller to the Game Object.
(4. ) Create an animation: 選擇所有的要做成animation的Sprites (選的順序會影響撥放順序),右鍵 create -> animation
(5. ) tune the speed of the animation.
Samples 16: 每秒撥放的數量
(6. ) 把該 animation 拉進 Animator -> Base Layer
Animation Event
Parent, Child & Animation的關係
補充:
1. Animation tab
2. Animator component
3. Animator Controller
4. Sprite Renderer