/// <summary> /// 移動処理 /// </summary> void Move() { float vertical = SwitchInput.GetVertical(0); float horizontal = SwitchInput.GetHorizontal(0); rigidbody.MovePosition(transform.position + (transform.forward * vertical + transform.right * horizontal) * moveSpeed * Time.deltaTime); }
/// <summary> /// 移動処理 /// </summary> void Movement() { float horizontal = SwitchInput.GetHorizontal(m_ThisPlayerNumber); float vertical = SwitchInput.GetVertical(m_ThisPlayerNumber); //移動量の加算 m_MoveValue += new Vector2(horizontal, vertical); }
private void FixedUpdate() { if (!GameOver && GameStart && !FieldManeger.Instance.Pause_Flg) { if (Mathf.Abs(SwitchInput.GetVertical(playerNumber)) >= 0.4f || Mathf.Abs(SwitchInput.GetHorizontal(playerNumber)) >= 0.4f) { //=====移動===== this.transform.Translate(Vector3.forward * walkSpeed * Time.deltaTime); //=====回転===== this.transform.rotation = Quaternion.LookRotation(transform.position + (Vector3.forward * SwitchInput.GetVertical(playerNumber)) + (Vector3.right * SwitchInput.GetHorizontal(playerNumber)) - transform.position); } } //重力 rb.AddForce(Vector3.down * 60f); }