How to find the point of impact in collision?
CapitalGames
Member Posts: 5
Hi all, I'm making a game and need to find the coordinates of the point of impact of 2 actors. I'm doing this so that I can place an explosion at that point, ie showing where the 2 actors collided.
Typically when there is collision detection, it's from a bullet/shot, and in those cases the bullet can spawn an explosion actor at it's coordinates, but what I have is 2 large actors and I want to show where exactly they collided.
I'm thinking that magnitude might be the direction to go?
Thanks in advance! This forum rocks!
Typically when there is collision detection, it's from a bullet/shot, and in those cases the bullet can spawn an explosion actor at it's coordinates, but what I have is 2 large actors and I want to show where exactly they collided.
I'm thinking that magnitude might be the direction to go?
Thanks in advance! This forum rocks!
Comments
Collision angle
You can click and drag any of the actors, and have them collide.
Once you get the angle, you can use this to determine the point of impact:
Finding coordinates of a point in a circle with angle
Unfortunately, I don't think they will work as my actors are not circles, they are long rectangles, so if they impact at an angle (like chopsticks) then if I use vector to angle between the 2 actors, it will give me an angle in between them, but not at the point of contact. I also do not know the distance from the center of each actor to that point. I know the length and width of the actor, but they are both different.
Too bad GS collisions don't just give you the coordinates of the collision.
which should be its length/2, width/2 ... and correlate that for both the collision actors
though we work mostly with angles and arcs of a circle... an angle is just the degrees of separation between two intersecting lines.
in plane geometry (2D) the sum of internal angles for each shape is 360° (the sum of the outside angles created by its lines is what determines the shape... )
as squares that are bisected on a diagonal consist of 2 triangles... you could use some trigonometry to determine actual impact site...
think it would be much simpler to look at and modify Tshirtbooth's...
MH