Throwing a rock, and making it do damage

At a point in the game, there are stones littered across a road. The player has to chase an enemy and pick stones up to throw at the enemy before they escape to the end of the road.

I need to make a script that automatically picks up the stone as soon as the player gets near it, and then right-click to throw the stone. After the stone gets thrown they can pick up the same stone or pick up a different stone. The player will automatically ignore any other stones they walk over so they can’t have two or three stones at once. The stone has to interact with the enemy, as in it bounces off of him, instead of just going straight through.

I’m really not looking for a “charge-up” mechanic, like the longer you hold a button it’ll get sent farther. I’d much prefer to build something a script that constantly sends it “x” distance away The game perspective is in third person so, instead of it being infront of the camera, i’d like for it to be in front of the actual player. But, I don’t have any animation for picking it up, so I just want to make it so it just hovers a bit in front of the player

I have tried finding scripts online and through youtube tutorials but a lot of them are outdated, or just plain do not work. I already have the player, scene, and stone models set up. Below is my health script (which is attached to a very basic health bar)

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class Health : MonoBehaviour
{
     public Image currentHealthbar;
     public Text ratioText;
     private float hitpoint = 100;
     private float maxHitpoint = 100;
     private void Start()
     {
         UpdateHealthbar();
     }
     private void UpdateHealthbar()
     {
         float ratio = hitpoint / maxHitpoint;
         currentHealthbar.rectTransform.localScale = new Vector3(ratio, 1, 1);
         ratioText.text = (ratio * 100).ToString("0") + '%';
     }
     private void TakeDamage(float damage)
     {
         hitpoint -= damage;
         if (hitpoint < 0)
         {
             hitpoint = 0;
             Debug.Log("Dead!");
         }
         UpdateHealthbar();
     }
}

Do you have any script(s) that deals with the question at hand?

Some ideas that come to mind:

  1. track if you’re holding a stone (so to prevent further pickups)
  2. using a trigger to automatically pick-up a stone, if allowed.
  3. using the forward direction of the player for throwing.
  4. applying force or velocity to the stone to throw it
  5. a separate trigger check for if it hits something/someone to which it can do damage.