左右キーで、その方向にY軸回転
if(Input.GetAxis("Horizontal") != 0){
transform.Rotate(0 , 100 * Time.deltaTime * Input.GetAxis("Horizontal") , 0);
}
上下キーで、Z軸方向のベクトルを作り、
そのベクトルを、local→world変換して、thisを動かす
if(Input.GetAxis("Vertical") != 0){
var varticalMove = Input.GetAxis("Vertical");
direction = new Vector3(0 , 0 , varticalMove);
direction = transform.TransformDirection(direction);
direction *= speed;
playerController.Move( direction * Time.deltaTime );
}
transform.Translate(Input.GetAxis("Horizontal")*speed,0,Input.GetAxis("Vertical")*speed);
最終更新:2015年04月01日 23:33