Why use negative vertice values

I came across some examples where they create a vertice like:

Code: Select all

   vertices[0].Set(2, 0);
   vertices[1].Set(2, 10);
   vertices[2].Set(-2, 10);
   vertices[3].Set(-2, 0);



What is the benefit of using negative values, are there any consequences for the b2body?

Is it any different from

Code: Select all

   vertices[0].Set(4, 0);
   vertices[1].Set(4, 10);
   vertices[2].Set(0, 10);
   vertices[3].Set(0, 0);
Setting vertices for the shape are relative to the body's position so the first example will look like:

O - body's position (the point left of it)
_ _ _ _
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
- - O -
The second example will look like
_ _ _ _
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
O - - -
engineer202 wrote:Setting vertices for the shape are relative to the body's position so the first example will look like:

O - body's position (the point left of it)
_ _ _ _
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
- - O -
The second example will look like
_ _ _ _
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
|-----|
O - - -


Good one 🙂

Original thread: https://box2d.org/forum/viewtopic.php?t=10142