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

  1. Crate model (sigle object, or multiple objects)

images/blender/rig_001.png

  1. Add Armature ([Add] -> [Armature] -> [Single Bone])

images/blender/rig_002.png

  1. Select models(create at 1.), and Armature(create at 2.), and then Ctrl+P -> [With Automatic Weights]

    (Shift + Right-Click to select multiple objects)

images/blender/rig_003.png

Then [Pose Mode], model move allow bones(armatures).

Create Animation

http://www.project-unknown.jp/entry/2017/05/06/205948

  1. Show DopeSheet

images/blender/dope_sheet.gif

  1. Change to [Action Editor], and name Action (ex. RunningForm)
  2. Select Bones, Insert KeyFrame ([I] key) -> LotRoc or LotRocScale

(Repeat number of animations)

  1. Export .fbx file

Unity Import

  1. Drag & Drop the .fbx file
  2. Add [Animator Conroller] in Project Window. and double-click.
  3. Add State in [Animator], add State of each animation, and set Motion (In Fbx Prefab)

images/blender/anime_001.png

  1. Drag to Prefab to Hierarchy, (Option)[Mesh Collider] has Mesh (In Fbx Prefab).

images/blender/anime_002.png

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].

images/blender/anime_003.png

    public void ToggleChanged(bool value)
    {
        anime.SetBool("ParameterName", value);
    }

    public void ButtonPushed()
    {
        anime.Play("StateName", 0);
    }