5 posts
• Page **1** of **1**

So I'm basically trying to make this explosion push things outwards via physics impulse with this formula as the angle "angle(self.X, self.Y, ExplosionBox.X, ExplosionBox.Y"

However, it pushes the objects in a very strange direction. As you can see from the picture, there are 2 lines. The line between Point 1 and 2 is the angle that the objects are being thrown at, but I would rather have an angle like the other one. How can I go about this? Is there a way for me to get the coordinates for point 3?

**Posts:**234**Reputation:**3,467

B

10
S

3
G

3
R0J0hound wrote:I'm not sure what line you mean by the other one. Do you mean point 1 to point 3?

It looks like you can get point 3 with (x2, y2+radius) if that helps.

Yes, not necessarily the coordinates of point 1 to point 3, but the angle. That formula unfortunately doesn't help me very much because I'm looking for the coordinate of, or the angle to the point of impact between the circle and the rectangle.

**Posts:**234**Reputation:**3,467

B

10
S

3
G

3
So in the picture which is the object to push and which is the explosion? Normally an explosion is round so the angle to push the object would be angle(explosion.x, explosion.y, obj.x, obj.y).

It's possible to calculate the point of collision between a circle and a box but it's not really trivial. In your picture at least the angle from 1 to 2 is not much different than 1 to 3. I guess I'm not fully understanding the issue. Could you post a capx perhaps?

It's possible to calculate the point of collision between a circle and a box but it's not really trivial. In your picture at least the angle from 1 to 2 is not much different than 1 to 3. I guess I'm not fully understanding the issue. Could you post a capx perhaps?

**Posts:**5,274**Reputation:**69,959

B

92
S

32
G

107
R0J0hound wrote:So in the picture which is the object to push and which is the explosion? Normally an explosion is round so the angle to push the object would be angle(explosion.x, explosion.y, obj.x, obj.y).

It's possible to calculate the point of collision between a circle and a box but it's not really trivial. In your picture at least the angle from 1 to 2 is not much different than 1 to 3. I guess I'm not fully understanding the issue. Could you post a capx perhaps?

Yes. That's what I'm doing. However, point 1 is obj.x, obj.y, and the line connecting point 1 and point 2 is the angle of propulsion, even though the contact point is at point 3, and the expected angle is closer to that of the line between point 3 and point 2.

**Posts:**234**Reputation:**3,467

B

10
S

3
G

3
5 posts
• Page **1** of **1**

## Who is online |

Users browsing this forum: brunopalermo, jorgmaquoi, zenox98 and 26 guests |