can someone help me with IsNotTouchingLayers? :
code
if (Input.GetButtonDown(“Jump”) && foot IsTouchigLayers (ground) {
body.AddForce(Vector2.up * jumpForce);
[SerializeField] private float groundCheckRadius;
[SerializeField] private bool isGrounded;
[SerializeField] private float jumpForce;
public Transform groundCheck; //Drag an empty game Object to this and put it on the feet (TheSprite)
private Rigidbody2D body;
//private Animator myAnim;
public LayerMask whatisGround;
void Start() {
jumpForce = 1.0f;
groundCheckRadius = 0.5f;
//myAnim = GetComponent<Animator> ();
body = GetComponent<Rigidbody2D> ();
}
void Update{
if (Input.GetButtonDown("Jump") && _isGrounded)
{
body.velocity = new Vector3(body.velocity.x, _jumpSpeed, 0f);
}
}
void FixedUpdate()
{
if (Input.GetButtonDown("Jump") && _isGrounded)
{
body.velocity = new Vector3(body.velocity.x, _jumpForce, 0f);
}
}
private void LateUpdate()
{
GroundChecker();
}
private void GroundChecker()
{
isGrounded = Physics2D.OverlapCircle
(groundCheck.position,
groundCheckRadius,
whatisGround); //Sets bool to true
//myAnim.SetFloat("Speed", Mathf.Abs( body.velocity.x));
//myAnim.SetBool("Grounded", isGrounded);
}
vote me up to keep me around.