7 posts
• Page **1** of **1**

Not sure if Construct 2 has a built-in method for this, or if there's an easy mathematical approach... if an item is rotated and it's hit by another object, how can I calculate which part of the object is hit? I know I can work out the angle between the two objects, but if the main object (i.e my player ship) is rotated, how can I tell which part is hit (e.g the left wing, the right wing, the cockpit etc)?

**Posts:**446**Reputation:**5,633

B

25
S

5
G

3
I too would like to know this. This could be very useful for a fighting game where, depending on the attack, a player would be flung in different directions. Maybe something like an equation to calculate a perpendicular angle using the line between two collision points?

**Posts:**405**Reputation:**3,219

B

32
S

4
I think I'm right in saying that you can calculate it by the collision angle minus your facing angle. I think that works. If the collision hits you at 90 degrees (from below) and you're facing 180 degrees (left), then the hit came at 90 - 180 = -90 (converts to 270), which is your left, which is correct.

If the collision came from above (270 degrees) and you were facing left (180), then the angle would be 270 - 180 = 90, which is your right.

That works for my case at least, hope it helps :)

If the collision came from above (270 degrees) and you were facing left (180), then the angle would be 270 - 180 = 90, which is your right.

That works for my case at least, hope it helps :)

**Posts:**446**Reputation:**5,633

B

25
S

5
G

3
7 posts
• Page **1** of **1**

## Who is online |

Users browsing this forum: No registered users and 2 guests |