# Create Particle object at collision point between two objects

I was trying to create a specific particle at a collision point between one sprite and another. Is there a way to do that?

Just a suggestion: maybe you may create the particle object halfway between the center of the two sprites? This works if the sprites have similar size

No, I need it to be exactly at the collision X Y of both of the sprites, its a top-down car game and when the car collides with the wall i want the â€śscrapesâ€ť to appear where the car has been hit

Ok, so in this case you have already the x position, donâ€™t you?

what do you mean? if you mean that i didnt specify that its a top down car racing game?

I mean, is it a fixed wall on the side or it could be an obstacle? In the first case you know the x position of the impact and you need to calculate juste the y

It is a fixed wall, its not moving. I just donâ€™t get how do i already have the X position and how can i calculate the y

The x position of the impact is the x position of the border of the wall.

How can I get the x position of the border of the wall?

check out the geometry monster exampleâ€¦they got it pretty good

I need to know more about the game, but I think that maybe you could find it in the scene editor?
In any case, the collision is always on the side of the car, isnâ€™t it? So it is always in the same point? You have just to find if it is in the right or left side

The car can have the collision at any position. at the back, front or side.
Yellow is the wall.

In the example, the particles are created at the center of the shape that is hit, but not at the place where it is actually hit, for example: as you can see here it is created at the center of it
if i were to use the same method as in here it would just create the particle at the center of the wall, inside it. I want the car to have â€śscrapesâ€ť particles AT the hit position of the car itself and the wall, not at the center of it.

Ok, now I see. Maybe you could create some possible impact points (3-4 for side) on the car sprite, and check for each of them if their x ccordinate is greater then the x coordinate of the wall. If true, you create the particle on the impact point

Yeah I get it, though is there somewhat of a scripted way to do this?

I really donâ€™t know, but I think that 15 possible collision points are enough. Maybe you could get the xposition of each one in a structured variable manually, which is not so time taking, and then use a repeat cycle for checking the collision on the strucured variable

1 Like