I have a 2D game where you mine asteroids with a laser. I have accomplished this using a raycast with a line renderer. My trouble comes when adding torque to the asteroid. I want the asteroid to spin if it is hit at an angle but I can’t seem to figure out an equation for determining rotation direction (clockwise or counter-clockwise) and an equation that will then give the appropriate amount of torque for the offset. Thanks for the help.
Solved. Super simple. You get the equation for the line between your player your object using y=mx+b and the 2 positions. Then find out if the Y-value of your hit point is above or below the Y-value for your line when the X-value of your hitpoint is plugged into your line equation. That will tell you if your raycast hit to the left or right of center and whether it should spin clockwise or counter-clockwise.