Hitting Lose Collider after 6 seconds

Hello. I’m having the same problem as reported in Lose Collider weirdness. But my ball and paddle both have Z value of 0. Here’s what I’ve done/found so far:

  • In LoseCollider.OnTriggerEnter2D, replaced scene change with debug log
    – Debug.Log("Collider hit by " + collision.ToString() + " with transform " + collision.transform.position);
  • When I run the game, after 6 seconds, the collider is hit
    – Collider hit by Ball (UnityEngine.CircleCollider2D) with transform (4.3, -0.3, 0.0)
    – Collider hit by Ball (UnityEngine.CircleCollider2D) with transform (1.0, -1.7, 0.0)
  • Can still see in the unity properties that Ball and Paddle Z values are 0
  • Ball is still on top of the Paddle - there is no visual indication it has fallen through
  • Doesn’t matter if I’m moving the paddle or not
  • If I turn off the CircleCollider2D on the ball, the Lose Collider hit does not trigger.
  • If I comment out “transform.position = paddlePos + paddleToBallVector;” and just keep the ball resting on the paddle, the lose collider hit does not trigger

:man_shrugging: thanks!

1 Like

Hi Ryan,

Try to set the collision detection of your ball’s Rigidbody2D component to “Continuous”. If that does not work, try this:

void Start ()
{
    paddleToBallVector = transform.position - paddle1.transform.position;
    myAudioSource = GetComponent<AudioSource>();
    myRigidBody2D = GetComponent<Rigidbody2D>();
    myRigidBody2D.simulated = false; // <-------- add this
}

private void LaunchOnMouseClick()
{
    if (Input.GetMouseButtonDown(0))
    {
        hasStarted = true;
        myRigidBody2D.velocity = new Vector2(xPush, yPush);
        myRigidBody2D.simulated = true; // <-------- add this
    }
}

Did this fix it?

Ball > Rigidbody2D > Collision Detection -> Continuous fixed it. Thank you! (Sorry I missed that from the last thread.)

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms