How can I find this angle?

Get help using Construct 2

Post » Tue Jun 17, 2014 12:43 am

Image
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?
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Jun 17, 2014 1:04 am

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.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Tue Jun 17, 2014 1:12 am

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.
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Tue Jun 17, 2014 1:32 am

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?
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Tue Jun 17, 2014 1:55 am

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.
B
10
S
3
G
3
Posts: 234
Reputation: 3,467


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 11 guests