1
General / Re: Setting Sprite on a circle around the player in an angle to mouseposition
« on: September 29, 2012, 07:06:49 pm »
Okay I think now I got something that's very close to what I want.
My vectors consist of x and y coordinates
O = Object-Vector
M = Mouse-Vector
P = Player-Vector
r = radius
and this is what my algo comes down to:
It works flawless...except that it doesn't gimme the coords of the circle-side facing the mouse...instead it gives me the coordinates on the other side of the circle. Any ideas on how to fix it?
Greets,
Finn
PS: You helped me alot so far, you're great! )
EDIT: GOT IT!! Changed to :
My vectors consist of x and y coordinates
O = Object-Vector
M = Mouse-Vector
P = Player-Vector
r = radius
and this is what my algo comes down to:
O = P + r * (P - M) / (|P| - |M|)
It works flawless...except that it doesn't gimme the coords of the circle-side facing the mouse...instead it gives me the coordinates on the other side of the circle. Any ideas on how to fix it?
Greets,
Finn
PS: You helped me alot so far, you're great! )
EDIT: GOT IT!! Changed to :
Code: [Select]
O = P - r * (P - M) / (|P| - |M|)