A little geometry help for offset rotation
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:

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.

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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Sine is opp/hyp
Cos is adj/hyp
Tan is opp/adj
That just helped me on my CST today
Jack McGraw
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Well... I didn't do much but glad it's working!
Jack McGraw
Also if you don't want too many constraints you can unlock the red actor and access the blue actor positions and rotation directly without having to constrain them to a game attribute.
And thanks for the suggestion about constraints. I try to use unlocked scene attributes whenever possible.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User