0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Tiny Chacater Controller とは

Tiny Character Controller(以下、TCC)は、GitHub上で無料公開されている、キャラクターの挙動を複数の小さなコンポーネントを組み合わせて実現するシステムのことです。

具体的には、「Brain」「Check」「Control」「Effect」 という4つの基本的なコンポーネントを組み合わせることで、キャラクター挙動の構築・カスタマイズを簡単にしてくれます。

各コンポーネントの説明は、リポジトリ下部の解説ドキュメントに記載されています。

TCCのインストール

TCCをまだインストールしていない方は、こちらの記事を参考にインストールしましょう。

必要なコンポーネントのアタッチ

TCCでキャラクターをジャンプさせるには、JumpControl コンポーネントが必要です。
さっそく、キャラクターのオブジェクトにアタッチしましょう。

無事にアタッチすると、画像のように警告が表示されます。

これは、「いずれかの BrainGravity足元の接地判定頭上の接触判定 のコンポーネントを必要としている」ということなので、それぞれ1つずつアタッチしていきます。

警告が表示されなくなったら準備完了です。

TCCでキャラクターをジャンプさせる

続いて、キャラクターをジャンプさせる処理を実装します。
適当なスクリプトをプレイヤーにアタッチして、下記のコードをコピペして下さい。
そして、ボタンなどからJumpPlayerメソッドを呼び出しましょう。

using UnityEngine;
using Unity.TinyCharacterController.Control;

public class Test : MonoBehaviour
{
    private JumpControl _jumpControl;
    void Start()
    {
        _jumpControl = GetComponent<JumpControl>();
    }

    public void JumpPlayer()
    {
        _jumpControl.Jump();
    }
}

ボタンを押すとプレイヤーがジャンプするのが確認できると思います。
これで、TCCでキャラクターをジャンプさせることに成功しました!

JumpControlコンポーネントの各プロパティを設定することで、
自分好みのジャンプ挙動を実装することもできます。

ご覧いただきありがとうございました :laughing:

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?