Math question... offset spawned actor between 0,0 and another actor
BarkBarkCo
Member Posts: 1,400
I have a ball that travels around the screen. If you draw an imaginary line from 0,0 to my ball actor, I need to spawn different actor 40 pixels below my ball, down that line... Does that make sense? I just need the math for positioning the second actor. Thanks!
Comments
y = (magnitude(ballX, ballY)-40)*sin(vectorToAngle(ballX, ballY))
note: this is simplified because your start point is 0,0
if it were not 0, 0 you would compute the magnitude and the vectortoangle slightly differently: targetx - startx, targety - starty. But because startx and starty are 0 you can omit them from the equation.
ORBZ for moderator!!