Unity Blender - nomrand/__basics GitHub Wiki
Axis
In Blender, [File > Export > FBX] setting,
- [Forward] = Z Forward
- [Up] = Y Up
- check ON [Apply Transform]
images/blender/blender_fbx_export.png
goes to axis
Unity | Blender |
---|---|
x | x |
z | y |
y | z |
Animation
Add Bones to Model
- Crate model (sigle object, or multiple objects)
- Add Armature ([Add] -> [Armature] -> [Single Bone])
-
Select models(create at 1.), and Armature(create at 2.), and then Ctrl+P -> [With Automatic Weights]
(Shift + Right-Click to select multiple objects)
Then [Pose Mode], model move allow bones(armatures).
Create Animation
http://www.project-unknown.jp/entry/2017/05/06/205948
- Show DopeSheet
- Change to [Action Editor], and name Action (ex. RunningForm)
- Select Bones, Insert KeyFrame ([I] key) -> LotRoc or LotRocScale
(Repeat number of animations)
- Export .fbx file
Unity Import
- Drag & Drop the .fbx file
- Add [Animator Conroller] in Project Window. and double-click.
- Add State in [Animator], add State of each animation, and set Motion (In Fbx Prefab)
- Drag to Prefab to Hierarchy, (Option)[Mesh Collider] has Mesh (In Fbx Prefab).
Animation script mangement
To Invoke Specific Motion by Specific Event(ex. Key, Button, ...)
- Create State, and [Animetor] Component's "Play" method by script.
To change Motion by Specific condition
- In [Animetor] window, select a transition, and set [Condition].
public void ToggleChanged(bool value)
{
anime.SetBool("ParameterName", value);
}
public void ButtonPushed()
{
anime.Play("StateName", 0);
}