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

Get help using Construct 2

### » 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
33
S
14
G
3
Posts: 801
Reputation: 6,316

### » 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
128
Posts: 5,490
Reputation: 81,543

### » 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
33
S
14
G
3
Posts: 801
Reputation: 6,316

### » 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

### » Thu Jul 30, 2015 1:07 pm

@LittleStain

thanks, this was helpfull!!!
B
33
S
14
G
3
Posts: 801
Reputation: 6,316

Return to How do I....?

### Who is online

Users browsing this forum: seriousfun and 28 guests