Hello I have this bit of unityCode to check if a character is grounded
`private void FixedUpdate(){ is_on_ground = false;
// The player is grounded if a circlecast to the groundcheck position hits anything designated as ground
// This can be done using layers instead but Sample Assets will not overwrite your project settings.
Collider2D[] colliders = Physics2D.OverlapCircleAll(m_GroundCheck.position, k_GroundedRadius, m_WhatIsGround);
for (int i = 0; i < colliders.Length; i++) {
if (colliders[i].gameObject != gameObject) {
is_on_ground = true;
}
}
}`
Can someone explain what the if-statement if (colliders[i].gameObject != gameObject) does?
Aucun commentaire:
Enregistrer un commentaire