Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions external/b2Separator-cpp/b2Separator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ bool b2Separator::SeparateAndCreateFixtures( b2Body *body,
FixtureCreator_t fixture_creator,
b2Vec2Vector &vertices_vec,
b2Vec2 &translate,
b2Vec2 &scale )
b2Vec2 &scale,
bool needHull
)
{
bool vertices_added = false;

Expand Down Expand Up @@ -97,7 +99,7 @@ bool b2Separator::SeparateAndCreateFixtures( b2Body *body,
DEBUG_PRINT( "*** Fixture %03d : Vertex %03d : x, y: %f, %f\n", i, j, v.x, v.y );
}

bool ok = polyShape.Set( &( vertices[ 0 ] ), (int)m );
bool ok = polyShape.Set( &( vertices[ 0 ] ), (int)m, needHull);
if( ! ok )
{
// Set() failed. Skip this polygon.
Expand Down
2 changes: 1 addition & 1 deletion external/b2Separator-cpp/b2Separator.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class b2Separator {
FixtureCreator_t fixture_creator,
b2Vec2Vector &vertices_vec,
b2Vec2 &translate,
b2Vec2 &scale );
b2Vec2 &scale, bool needHull);

/**
* Checks whether the vertices in <code>verticesVec</code> can be properly distributed into the new fixtures (more specifically, it makes sure there are no overlapping segments and the vertices are in clockwise order).
Expand Down
15 changes: 13 additions & 2 deletions librtt/Rtt_LuaLibPhysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,12 @@ InitializeFixtureUsing_Outline( lua_State *L,
b2Body *body,
float meter_per_pixels_scale )
{

lua_getfield(L, lua_arg_index, "needHull");
bool needHull = (lua_isboolean(L, -1) &&
lua_toboolean(L, -1));
lua_pop(L, 1);

lua_getfield( L, lua_arg_index, "outline" );
if( lua_istable( L, -1 ) )
{
Expand Down Expand Up @@ -1870,7 +1876,7 @@ InitializeFixtureUsing_Outline( lua_State *L,
_FixtureCreator,
vertexList,
translate,
scale );
scale, needHull);
if( ! ok )
{
DEBUG_PRINT( "SeparateAndCreateFixtures() failed to add any fixtures." );
Expand Down Expand Up @@ -2099,6 +2105,11 @@ InitializeFixtureUsing_Shape( lua_State *L,
b2Body *body,
float meter_per_pixels_scale )
{
lua_getfield(L, lua_arg_index, "needHull");
bool needHull = (lua_isboolean(L, -1) &&
lua_toboolean(L, -1));
lua_pop(L, 1);

lua_getfield( L, lua_arg_index, "shape" );
if ( lua_istable( L, -1 ) )
{
Expand Down Expand Up @@ -2128,7 +2139,7 @@ InitializeFixtureUsing_Shape( lua_State *L,
b2PolygonShape polygonDef;

bool ok = polygonDef.Set( &vertexList[ 0 ],
(int)vertexList.size() );
(int)vertexList.size(), needHull);
if( ok )
{
InitializeFixtureFromLua( L,
Expand Down