A
Size: a a a
AM
MW
void OnCollisionEnter(Collision col){
Vector3 normal = col.GetContact (0).normal;
if (col.collider.CompareTag("Cube")) {
if (Mathf.Abs (normal.x) > Mathf.Abs (normal.y)) {
if (isGrounded) {
isRight = !isRight;
}
} else {
if (transform.position.y > col.gameObject.transform.position.y) {
isGrounded = true;
Ground = col.gameObject;
}
}
}
}
void OnCollisionExit(Collision col) {
if (col.gameObject == Ground)
isGrounded = false;
}
AM
MW
AM
AM
AM
AM
IП