I ask this because I have this code
void Update ()
{
piso = Physics2D.OverlapCircle (gdchk.position, gdradius, 1 << LayerMask.NameToLayer("suelo")); //es un booleano que sera true o false si toca el suelo o no
//Debug.Log (rigidbody2D.velocity.y);
//if (piso || (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)) == 0 && transform.position.y < 7.1))
//if (piso || (rigidbody2D.velocity.y == 0 && transform.position.y < 7.1))
if (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)) == 0 && transform.position.y < 7.1)
{
// Debug.Log (Mathf.Floor(Mathf.Abs(rigidbody2D.velocity.y)));
// Debug.Log (transform.position.y);
//elemento.rigidbody2D.isKinematic = true;
suelo = true;
Semillero2.pieza = false;
}
//Debug.Log (suelo);
}
with this code the last two variables are no receiving the values I want, but the same code with FixedUpdate instead, the value of the variables is received, why? What does Update and what does FixedUpdate do?