PlayerBehavior Fri
PlayerBehavior Fri
Collections;
using System.Collections.Generic;
using UnityEngine;
void Start()
{
_rb = GetComponent<Rigidbody>();
_col = GetComponent<CapsuleCollider>();
}
void Update()
{
_vInput = Input.GetAxis("Vertical") * MoveSpeed;
_hInput = Input.GetAxis("Horizontal") * RotateSpeed;
_isJumping |= Input.GetKeyDown(KeyCode.Space)
void FixedUpdate()
{
if (IsGrounded() && _isJumping)
{
_rb.AddForce(Vector3.up * JumpVelocity, ForceMode.Impulse);
}
_rb.MovePosition(this.transform.position + this.transform.forward *
_vInput * Time.fixedDeltaTime);
_rb.MoveRotation(_rb.rotation * angleRot);
_isJumping = false
}
return grounded;
}
}