mouseclick to jump

Hi guys

I have this code below that checks the clicking on a space where a card is to reveal it

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	
	if (Input.GetMouseButtonDown (0))
	{
		if (Physics.Raycast (ray, hit, 100)) 
		{
			if (! matchOne)
			{
				revealCardOne();
			}
			else
			{
				yield revealCardTwo();
				if (cardsLeft == 0) 
				{
					yield gameWon();
				}
			}
		}

Now there is also a moving sphere on the platform, and instead of clicking with the mouse, I’d like it so when you move the sphere ontop of the card and hit jump instead of clicking on it that it reveals the card…

Can anyone point me in the right direction?

Greatly appreciated!

You can probably do something where if (Input.GetButton (“Jump”) check the distance between the sphere and the card. If the distance is just outside the sphere’s radius do your stuff.

If you require more precision you can add a box collider to the card and a sphere collider to the sphere and see if they are touching at the jump event.