Click an object to applyforce in different directions.

I can applyforce to a gameobject and have it go in 1 direction when i click on it. With something like this

rigidbody2D.AddForce(transform.up * speed);

however i want to click on the object and apply force in different directions depending on where i click on the object.

so for example clicking the green portion of the object will apply force to the right and up. while blue will apply force to the left and up. and the majority of the middle will just apply force upwards.
Perhaps i can create colliders as children and send message to the main object to applyforce in a certain direction? there has to be an easier way to do this.


You simply get the direction of the mouse to the game object and apply force base on the direction:

Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3 dir = gameObject.transform.position - mousePos;
rigidbody.AddForce(dir.normalized * force, ForceMode.Impulse);