Is it possible to add Ghost Vertices on Edge Shape Body?

Hello, we are migrating from Cocos2D + Box2D to Corona SDK. We are building a scooter game with an infinite path. The problem is that the wheels collide with the vertices of each Edge Shape and the scooter keeps jumping. The ground is created ahead dynamically according to the movement of the scooter. In Cocos2D + Box2D we solved this problem adding what is called Ghost Vertices to each Edge Shape. How can we solve this in Corona?

Thanks

Marco

Nope, Corona’s “chain” body shape is an abstraction around box2d’s edgeShape fixture - you can’t get at the individual edgeShape fixtures to set their ghosts.

but a plain edge shape ought to be pretty stable, depending on how it’s used, it’s really only the end vertices that (typically) still remain an issue.  (and also depends on other aspects of your sim)  for example, what are we looking at in your screenshot - a single body with 14 vertices?  or 13 individual 2-vertex bodies?  the latter will (likely) experience more trouble than the former.

 if you have to do them as individual 2-vertex bodies, you could try making them 4-vertex chains, setting the first and last vertex to be coincident with the rest of the chain, then deflecting them downward a tiny bit - creates nearly correct normals, but prevents collision, much the same as ghost vertices.  (in debug view it’ll look like tiny sliver X’s around each “real” vertex)

Thanks, bro! It worked like a charm. I created the 4-vertex chains and deflected the edges downward a little bit like you said. Now the car movement is smooth.  :smiley:

Nope, Corona’s “chain” body shape is an abstraction around box2d’s edgeShape fixture - you can’t get at the individual edgeShape fixtures to set their ghosts.

but a plain edge shape ought to be pretty stable, depending on how it’s used, it’s really only the end vertices that (typically) still remain an issue.  (and also depends on other aspects of your sim)  for example, what are we looking at in your screenshot - a single body with 14 vertices?  or 13 individual 2-vertex bodies?  the latter will (likely) experience more trouble than the former.

 if you have to do them as individual 2-vertex bodies, you could try making them 4-vertex chains, setting the first and last vertex to be coincident with the rest of the chain, then deflecting them downward a tiny bit - creates nearly correct normals, but prevents collision, much the same as ghost vertices.  (in debug view it’ll look like tiny sliver X’s around each “real” vertex)

Thanks, bro! It worked like a charm. I created the 4-vertex chains and deflected the edges downward a little bit like you said. Now the car movement is smooth.  :smiley: