LoginSignup
1
0

More than 5 years have passed since last update.

Unity

Posted at

位置について

Transformの値を拾うには

transform.position
transform.rotation
transform.lossyScale
transform.localScale

キー入力

キー入力にはInputクラスを使用します。
https://docs.unity3d.com/ja/current/ScriptReference/Input.html

KeyCode.で候補が出てきます。
定義はenumでされているようです。

スクリーンショット 2019-01-03 17.43.37.png

// スペースキーを押した時にhogehogeを出力する
// GetKeyは識別されたキーを押している間、trueを返します
Input.GetKey(KeyCode.space){
  Debug.Log("hogehoge");
}

上下左右

// 左右のキー入力
Input.GetAxis("Horizontal");
// 上下のキー入力
Input.GetAxis("Vertical");
1
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
1
0