Quest: Pinball
Challenge: Bumpiness
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
Quest: Pinball
Challenge: Bumpiness
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
Continuing the discussion from PINBALL QUEST: ‘Bumpiness’ - Solutions:
Not sure how efficient this is but I used a RayCast pointing right to hit the right bumper. this would only hit the bumper if the ball was on the left (in front of the bumper) it would not hit the bumper from the other side. Used a bool and AddForce. replicated the process for the left bumper.
hit2DR = Physics2D.Raycast(transform.position, Vector2.right);
hit2DL = Physics2D.Raycast(transform.position, Vector2.left);
if (hit2DR.collider.CompareTag(“Right Bumper”))
{
rightHit = true;
}
else
{
rightHit = false;
}
if (hit2DL.collider.CompareTag("Left Bumper"))
{
leftHit = true;
}
else
{
leftHit = false;
}