LoginSignup
6
13

More than 5 years have passed since last update.

UnityでFinal IKを使ってみた時のメモ

Last updated at Posted at 2017-12-16

昔はC#をメインで使ってたのでホームに帰ってきた気分。
unityのIDEさえ覚えれば使えるようになる。
ゲームプログラマにとっては当たり前の操作なのかもですが、
あまり関節とか意識することがなかったので勉強しようと思ってアセットを買いました。

Final IK
https://www.assetstore.unity3d.com/jp/#!/content/14290

とりまこれでいいだろうと思って買いました。
ちょっと前まで半額だったそうで、良さげのアセットは半額のうちに買っとけって感じみたい。

まずはボールに向かってパンチ

実行してみる

Aim IKをダブルクリック。

スクリーンショット 2017-12-16 午後1.13.22.png

▷の実行ボタンを押すと動く。

スクリーンショット 2017-12-16 午後1.21.55.png

スクリーンショット 2017-12-16 午後1.24.57.png

スクリーンショット 2017-12-16 午後1.25.18.png

unityではGameObject.GetComponentを使わないと呼べないオブジェクトとGameObject.GetComponentを使わなくても呼べるオブジェクトがあるようです。
https://docs.unity3d.com/jp/540/ScriptReference/GameObject.GetComponent.html

Transformとかは使わなくても呼べる系でpublic Transformと言う感じで直で呼べてます。
ボールのpositionに向けてアニメーションを実行する流れ。

スクリーンショット 2017-12-16 午後1.26.40.png

        public AimIK aimIK; // Reference to the AimIK component
        public Transform pin; // The hitting point as in the animation

        void LateUpdate() {
            // Rotate the aim Transform to look at the point, where the fist hits it's target in the animation.
            // This will set the animated hit direction as the default starting point for Aim IK (direction for which Aim IK has to do nothing).

            print (pin.position);

            aimIK.solver.transform.LookAt(pin.position);

            // Set myself as IK target
            aimIK.solver.IKPosition = transform.position;
        }

スクリーンショット 2017-12-16 午後1.17.23.png

スクリーンショット 2017-12-16 午後1.17.53.png

スクリーンショット 2017-12-16 午後1.18.18.png

boxingボタンをクリック。
motionの右の青色のポチを押すとselect motion画面が現れてモーションを変更できる。

スクリーンショット 2017-12-16 午後1.19.57.png

モーションを変更できる。

スクリーンショット 2017-12-16 午後1.20.12.png

サイド実行するとモーションが変わってる。

運転する

スクリーンショット 2017-12-16 午後3.05.30.png

おそらくFull Body Biped IKにてrigを操作してる。
あとはanimatorにidleがついてるので、なんもしてないけどたまに揺れる動きをする。

スクリーンショット 2017-12-16 午後3.04.03.png

6
13
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
6
13