I have a ball…sphere, or a circle (since its 2d, or i guess it might not matter, anyway). If a player clicks/taps near the ball, it pushes the ball away from the click position. The closer the click is to the ball, the more force is used to push the ball.
If you press or click the top+left, the ball should move down+right. If you click close to the ball, it pushes it hard. If you click far from it, it barely pushes it.
Can someone explain what I would need to do to get this to work? Please be specific as possible because I am brand new to Unity and still learning the basics. Ideally, if you could explain the functions I would need and where, I will gladly look them up and see if I can figure out how to get them working. I really want to learn so I can apply my knowledge to other parts of my games when needed.
Sounds like you need to get a vector from the mouse to the ball, interpolate the force based on distance, then apply the force. This should put you on the right track:
// Getting a vector from A to B is given by (B - A)
Vector3 direction = ball.transform.position - cursorPosition;
// Find how far away we clicked as a percentage of the max distance clicking is allowed
float percentOfMaxRadius = direction.magnitude / maximumClickDistance;
// Clamp that value between zero and one, just to be safe, or use an if-statement to check whether we should proceed
percentOfMaxRadius = Mathf.Clamp01( percentOfMaxRadius );
// The force is determined by multiplying the normalized direction with a scalar we get based on our click distance
Vector3 force = direction.normalized * Mathf.Lerp(maxForce, minForce, percentOfMaxRadius);
// Then add the force to the rigidbody, or do your own calculations with the resultant force vector
ball.rigidbody.AddForce( force, ForceMode.Impulse );