# Collision position

Get help using Construct 2

### » Tue May 08, 2012 3:50 pm

Is there a easy way to pinpoint exactly where the collision between two sprite take place?

Lerp would work really well but one of the sprite is growing in size from 20px to 200px and can collide with the other sprite anywhere there between.

I'm using lerp to calculate the distance between the middle points, so when the sprite is at 200px for example, the collision is a bit offset.

So lerp(ring.X,square.X,0.5) does work but not when the ring is at 200px size.

I'm creating a particle effect when they collide, so it has to be at the collision X,Y position.
B
8
S
3
G
5
Posts: 70
Reputation: 2,834

### » Tue May 08, 2012 6:19 pm

Your lerp system is probably about as accurate as it can be. You could try taking in to account the sizes of the objects to improve it slightly.

Collisions don't actually occur at specific points: collisions are always regions of the objects overlapping each other, which is going to be an unusually shaped polygon rather than a point. So since collisions have an area, there's no one point you can say the collision happened at. Estimating based on the object sizes, distance apart and relative angle is the best way to go.
Scirra Founder
B
415
S
248
G
92
Posts: 25,287
Reputation: 200,958

### » Tue May 08, 2012 7:27 pm

Ah brilliant, found out by using the same lerp and adding one more action.

Moved particle at angle of the two sprites. Found out the distance by using the distance expression to calculate the length between the particle and the square. Works like a charm :)
B
8
S
3
G
5
Posts: 70
Reputation: 2,834