Hey guys, i am making a platformer, but my player character keeps either jumping off of walls or sticking to them. No tuttorial i found helped. Right now i stick to walls if i just keep pressing the movement.
My colliders:
My movement Code:
void Update()
{
inputValue = Input.GetAxisRaw("Horizontal");
if (Input.GetKeyDown(KeyCode.Space) && feetCollider.IsTouchingLayers(GroundMask))
{
rb.AddForce(new Vector2(0, jumpValue), ForceMode2D.Impulse);
isGrounded = false;
}
//animation
if (Input.GetMouseButtonDown(0))
{
animator.SetBool("isAttacking", true);
isAttacking = true;
}
if (Input.GetMouseButtonUp(0))
{
animator.SetBool("isAttacking", false);
isAttacking = false;
}
if (Input.GetKeyDown(KeyCode.LeftShift))
{
isRun = true;
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
isRun = false;
}
}
private void FixedUpdate()
{
transform.position = new Vector2(transform.position.x + (speed * inputValue * Time.deltaTime), transform.position.y);
Flip();
Debug.Log(isGrounded);
}