How do I detect overlaping from a certain angle???

Get help using Construct 2

Post » Wed Jul 29, 2015 11:50 pm

Hello,

I am having some trouble with overlaping.
I want to detect if overlaping object is comming from left or right side towards my player in top down view.
how can i detect that?

HELP!!!!

:)
B
31
S
13
G
2
Posts: 749
Reputation: 5,533

Post » Thu Jul 30, 2015 12:17 am

One way could be to compare the x positions of the colliding objects.
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Thu Jul 30, 2015 6:59 am

@R0J0hound

yes, iw started with that but that does not works quite well becouse my player (car) is moving in all directions...
i assume that i somehow need to find out "on overlapping" where is other player comming from... like if its comming from 0-180° to my player angle that would be "from right" and if he is comming from 181-359° that would mean "from left" side.... but i cant get that... :(
B
31
S
13
G
2
Posts: 749
Reputation: 5,533

Post » Thu Jul 30, 2015 8:12 am

Maybe this will work:

system is between angles:

angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle+179 (hit from right)
angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle-179 (hit from left)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 30, 2015 1:07 pm

@LittleStain

thanks, this was helpfull!!!
:)
B
31
S
13
G
2
Posts: 749
Reputation: 5,533


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 6 guests