Hey! I have been trying to make my own 2D physics engine under the holidays, but I can't get it to work. I've decided to take a look at Box2D Lite since it seems to use the easiest way of making a simple physics engine. After studying the code there is some things I quite don't uderstand.
What exactly does the function
do? Does it make sure that two objects aren't inside each other?
In
What does feature.value hold? I've been able to track it down to the clipping code, but I don't get the meaning of it.
Lastly, I want bodies being able to bounce in my physics engine, is it possible to use the sequential impulse method that Box2D Lite uses and just modify it so bodies can bounce?
Very thankful for any help 😉
What exactly does the function
Code:
int ClipSegmentToLine(ClipVertex vOut[2], ClipVertex vIn[2], const Vec2& normal, float offset, char clipEdge)
do? Does it make sure that two objects aren't inside each other?
In
Code:
void Arbiter::Update(Contact* newContacts, int numNewContacts)
there's this:Code:
if (cNew->feature.value == cOld->feature.value)
{
k = j;
break;
}
{
k = j;
break;
}
What does feature.value hold? I've been able to track it down to the clipping code, but I don't get the meaning of it.
Lastly, I want bodies being able to bounce in my physics engine, is it possible to use the sequential impulse method that Box2D Lite uses and just modify it so bodies can bounce?
Very thankful for any help 😉