Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Ghost Vertices for b2.EdgeShape — Gideros Forum

Ghost Vertices for b2.EdgeShape

twisttaptwisttap Member
edited January 2013 in General questions
@atilim today while digging the net I came across by a article about ghost vertices for edge shape in Box2d , mainly used to solve the stucking problem that occurs between two polygon shapes .

is it available in Gideros ? If yes , how :)


Box2D v2.2 introduced the concept of 'ghost vertices' for edge shapes. Each edge shape obviously has two main vertices used to define its position and detect when the edge has collided with something. These main vertices can each have a ghost vertex on the 'outside', as in this diagram: The ghost vertices get their name because they don't play a part in collision detection - other bodies can happily pass through the lines from v0-v1 and v2-v3 without colliding with the edge. So... what's the point of these ghost edges then? The point is that they play a part in collision response.

For example when a collision is detected at the v2 end of the main segment, both the v1-v2 and v2-v3 lines will be used to calculate the collision-response impulse. Remember how the whole getting stuck problem was caused by not being able to resolve collisions with more than one other fixture at a time? Well essentially, this is exactly what the ghost vertex system does for us. The result is that the collision response will act as if there was no discontinuous point at v2.

Using these ghost vertices is most commonly done by way of the b2ChainShape which sets up a string of edge shapes and takes care of all the ghost vertices automatically, placing the ghost vertices of each edge to match the main vertices of the edge on each side of it. If you need to set up a single edge with ghost vertices, you could do it like this:


Thanks
ghostvertices-setup.png
554 x 138 - 6K

Likes: DungDajHjep

+1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.