I have a character (the little, green, slimy thing on the attached picture) and an arrow that rotates between up and right. At the tip of the arrow, there’s an Object called “arrow_tip” which I want to use to tell my Character in which direction the character should fly.
I want to do this with addforce as it’s triggered once by a mouse click.
How do I tell the character to add force in the direction of the “arrow_tip” object?
I have tried the following:
if (Input.GetMouseButtonDown(0)
{
direction = new Vector2(arrow_tip.transform.position.x * strength, arrow_tip.transform.position.y *
strength);
rb.AddForce(direction);
}
where
- arrow_tip is the arrow_tip object (via a Serialized Field)
- strength is a float value between 0 and 10
Help is appreciated, if you need more information just tell me