位置について
Transformの値を拾うには
transform.position
transform.rotation
transform.lossyScale
transform.localScale
キー入力
キー入力にはInputクラスを使用します。
https://docs.unity3d.com/ja/current/ScriptReference/Input.html
KeyCode.
で候補が出てきます。
定義はenumでされているようです。
// スペースキーを押した時にhogehogeを出力する
// GetKeyは識別されたキーを押している間、trueを返します
Input.GetKey(KeyCode.space){
Debug.Log("hogehoge");
}
上下左右
// 左右のキー入力
Input.GetAxis("Horizontal");
// 上下のキー入力
Input.GetAxis("Vertical");