I added Photon To My Game And Now My Player Wont Jump, Not Sure What Is Causing this issue.
I had him jumping after but Something happened and I Had To Re import my player Model and start from scratch, I used all of the same code, and even attached a Rigidbody and Capsule collider to the player and I can not for the life of me figure out why when I hit space that the player won’t jump. Maybe someone can steer me in the right direction. Here is all the code involved with making the player jump. I know it’s something simple, Just can’t figure it out. Dnt even kno if it’s something to do with the code.
[Header("Jump Settings")]
public Vector3 jump;
public float jumpForce = 2.0f;
public float floorAngleThreshhold = 15.0f;
public bool IsGrounded = false;
Rigidbody RB;
private void Start()
{
_animator = GetComponent<Animator>();
RB = GetComponent<Rigidbody>();
jump = new Vector3(0.0f, 2.0f, 0.0f);
}
private void OnCollisionStay(Collision col)
{
foreach (ContactPoint hit in col)
{
if (Vector3.Angle(Vector3.up, hit.normal) <= floorAngleThreshhold)
{
IsGrounded = true;
return;
}
}
}
private void OnCollisionExit()
{
IsGrounded = false;
}
private void Jump()
{
if (IsGrounded)
{
if (Input.GetKeyDown(KeyCode.Space) && PlayerStat.StaminaBar.value > 0.3)
{
RB.AddForce(jump * jumpForce, ForceMode.Impulse);
_animator.SetTrigger("IsJumping");
}
else
{
_animator.SetBool("IsFalling", false);
_animator.SetBool("Landing", true);
}
}
else
{
_animator.SetBool("IsFalling", true);
}
}