# How do I retrieve collision point coordinate?

0 favourites
• 6 posts
• When there is collision happens, there is a point of collision. What expression should i use to retrieve the coordinate of that point?

• You'll have to calculate it manually. How hard it is to do that depends on the shapes.

If you want the collision point of circles:

Here is a capx of resolving a collision between a circle and boxes.

You can calculate the collision point in event 10 with:

I have also made a physics plugin with a "Post Collision" condition that you can use to get the collision point.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• thx for the information, just wondering if it is not a perfect circle and square shape. Like an aeroplane shape.

• Usually the method is to break the objects into convex shapes and find the collision points between them.

Another method I've read about would be to cast rays in the direction of motion from the points of one object to another, then the shortest line would indicate the points that hit first.

Here's a rough example of that:

• it would be cpu intensive, but thx for the method!

• You're welcome.

There is a lot of ways this can be made faster. One is to not cast the rays as far, since far apart objects wouldn't be colliding. Also only lines that hit should be considered for picking the closest from. Actually you'd want to use math to calculate the raycast points which may be faster than doing a looping collision check, and will be a lot more accurate.

Another thing you could do is only do this after a collision actually occurred. So the flow would be:

1. object overlaps another.

2. move object back to previous position

3. Ray cast collision points to find point of collision.

The only drawback of that is there is no expressions to access the collision points.