I'm trying to understand what collision normals are and how a collision happens and how that normal is created!? Any easy to understand online explanatory articles with visuals?
Collision normals
General DiscussionThis may be useful: http://www.iforce2d.net/b2dtut/collision-anatomy
Yes, I understand as far as this:

because of the whole time step deal and default not being bullet body.
And I understand that the next step is to get the contact normal which is precisely what i need to understand. But how do they get to this part:

It goes on to say:
"These are the points that will be used in the collision reaction when applying an impulse to push the fixtures apart."
"Next let's show the collision normal, which points from fixtureA to fixtureB:"
"It seems that for this collision, the quickest way to resolve the overlap is to apply an impulse that will push the corner of the triangle up and left, and the corner of the square down and right."
The image presented is this:

Im assuming he means the red & green lines are the "collision normal"? So I have 2 questions:
1. Why is the red-green line drawn in that direction when it could have been drawn in any of 359 other directions?
2. Why is the lower yellow point being used? The line above said "These are the points what will be used...." and they drew 2 yellow points.

because of the whole time step deal and default not being bullet body.
And I understand that the next step is to get the contact normal which is precisely what i need to understand. But how do they get to this part:

It goes on to say:
"These are the points that will be used in the collision reaction when applying an impulse to push the fixtures apart."
"Next let's show the collision normal, which points from fixtureA to fixtureB:"
"It seems that for this collision, the quickest way to resolve the overlap is to apply an impulse that will push the corner of the triangle up and left, and the corner of the square down and right."
The image presented is this:

Im assuming he means the red & green lines are the "collision normal"? So I have 2 questions:
1. Why is the red-green line drawn in that direction when it could have been drawn in any of 359 other directions?
2. Why is the lower yellow point being used? The line above said "These are the points what will be used...." and they drew 2 yellow points.
I went to this address:
http://www.falstad.com/dotproduct/
But Im trying to understand how to relate this to the triangle and rectangle example from iforce.
http://www.falstad.com/dotproduct/
But Im trying to understand how to relate this to the triangle and rectangle example from iforce.
marciokoko wrote:
1. Why is the red-green line drawn in that direction when it could have been drawn in any of 359 other directions?
2. Why is the lower yellow point being used? The line above said "These are the points what will be used...." and they drew 2 yellow points.
2. Why is the lower yellow point being used? The line above said "These are the points what will be used...." and they drew 2 yellow points.
1. The goal of the collision response is to take two overlapping shapes and calculate an impulse to push them apart so they stop overlapping. In most cases, there is only one direction which is optimal for this.
2. As the article also says "Please note that the normal is only a direction, it does not have a location and is not connected to either one of the points - I'm just drawing it at the location of points[0] for convenience."
I think you may be skim reading a bit too quickly 🙂
oh no, trust me, I'm not skimming, I'm reading things over and over about this. i really need to understand it.
Could you explain to me why those 2 yellow points where chosen?
So the vector is just being estimated to be that...it could very well be 15 degrees clockwise or 10 degrees counterclockwise?
Could you explain to me why those 2 yellow points where chosen?
So the vector is just being estimated to be that...it could very well be 15 degrees clockwise or 10 degrees counterclockwise?
The direction of the normal force is always perpendicular to the surface. That's a given in physics. Also, the angle of the shortest distance from a point to a line is perpendicular to the line. That's a math, uh, thing. You (or at least Box2D) wants to move the polygons as little as possible when trying to stop them from colliding, so naturally, you would use the shortest distance from the corner of the rectangle to the side of the triangle (or vice versa), which is conveniently the direction of the normal force of that side of the triangle.
As to how and why those two yellow points are generated, I have no clue. I can see in the iforce link that the main point being used (or drawn with the normal force) are between the side and the corner (the midpoint of that distance), but the other point, I have no idea.
As to how and why those two yellow points are generated, I have no clue. I can see in the iforce link that the main point being used (or drawn with the normal force) are between the side and the corner (the midpoint of that distance), but the other point, I have no idea.
ok I think i get it. I understand that a collision normal between 2 colliding objects (a triangle & a rectangle), is defined as a line which is perpendicular to the colliding surface. What do you mean by colliding surface:
a) The flat sided face - surface of the rectangle?
or
b) The so-called dividing axis, which is that imaginary axis drawn just before 2 objects are said to be colliding, which separates both objects without touching them?
So i guess even though in the image we see the objects overlapping, the normal direction probably was determined using the bullet body idea where the corner of the triangle actually touched the flat side of the rectangle at a single point.
I attached an image
a) The flat sided face - surface of the rectangle?
or
b) The so-called dividing axis, which is that imaginary axis drawn just before 2 objects are said to be colliding, which separates both objects without touching them?
So i guess even though in the image we see the objects overlapping, the normal direction probably was determined using the bullet body idea where the corner of the triangle actually touched the flat side of the rectangle at a single point.
I attached an image
+1 for not knowing exactly how the two points are calculated. The purpose of them is to have a point (or two if necessary) at which to apply an impulse to separate the shapes as quickly as possible and also to give a realistic looking response. To this end, the point(s) will be on the line that is the best midway point between the shapes. Maybe Erin can describe it better...
hmm... no.

screenshot.png [ 25.86 KiB | Viewed 136 times ]
marciokoko wrote:
... the normal direction probably was determined using the bullet body idea where the corner of the triangle actually touched the flat side of the rectangle at a single point.
hmm... no.
Attachment:
screenshot.png [ 25.86 KiB | Viewed 136 times ]
Ok then I'm lost again because I'm not seeing where those two yellow points came from.
How are those two yello points :
"the point(s) will be on the line that is the best midway point between the shapes"?
However I did understand something new:
"It's important to be aware that the collision normal does not give you the angle that these fixtures collided at - remember the triangle was moving horizontally here, right? - it only gives the shortest direction to move the fixtures so that they don't overlap"
Which means that the normal is simply a line, "perhaps perpendicular to the dividing axis" representing the shortest distance to push the bodies apart.
How are those two yello points :
"the point(s) will be on the line that is the best midway point between the shapes"?
However I did understand something new:
"It's important to be aware that the collision normal does not give you the angle that these fixtures collided at - remember the triangle was moving horizontally here, right? - it only gives the shortest direction to move the fixtures so that they don't overlap"
Which means that the normal is simply a line, "perhaps perpendicular to the dividing axis" representing the shortest distance to push the bodies apart.
Original thread: https://box2d.org/forum/viewtopic.php?t=8362