Angle/Mouse Coords

Blitz3D Forums/Blitz3D Programming/Angle/Mouse Coords

Jerome Squalor(Posted 2007) [#1]


Ok, How do I check if the mouse coordinates are within a certain one of the segments on the picture above?


big10p(Posted 2007) [#2]
???


Jerome Squalor(Posted 2007) [#3]
Im still working on it...:D


big10p(Posted 2007) [#4]
If you want to find the angle from the mouse to the screen centre, it's:
ATan2((GraphicsHeight()/2)-MouseY(),(GraphicsWidth()/2)-MouseX())


Jerome Squalor(Posted 2007) [#5]
Can someone give me a quick explanation of what values the Sin,Cos,Tan,ASin,ACos,ATan,ATan2 return.


Subirenihil(Posted 2007) [#6]
Trig Functions explained here

sector=Floor(ATan2(MouseX()-GraphicsWidth()/2,GraphicsHeight()/2-MouseY())/45)

Sector is 1 through 8, as shown:
\ 3|2 /
4 \|/ 1
5 /|\ 8
/ 6|7 \



Chroma(Posted 2007) [#7]
Kip I'll work on this tomorrow. Solving stuff like this interests me.

Right off hand, number each triangle 1 through 8.


Rob Farley(Posted 2007) [#8]
Or just use my intriangle function in the code archives