A little geometry help for offset rotation

tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
edited April 2012 in Working with GS (Mac)
I have a line that rotates in a circle on a fixed point (lineX, lineY). I want another line to be offset by about 10 pixels so that it is always on a tangential line to the circle that the initial line is creating when it rotates. A picture is worth a thousand words so:

image

Knowing the x,y values for the fixed point (the blue dot) and the rotation angle for the first line, how can I determine the x,y values for the second line (the red dot)?

The closest I've gotten is x=10*sin(lineAngle)+lineX; y=10*cos(lineAngle)+lineY. Unfortunately, it works okay but then the red line crosses over the blue line instead of staying on the tangent/circle.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

Sign In or Register to comment.