Convex Decomposition Issue with OBJ File

Post Reply
Pappers
Posts: 2
Joined: Thu Feb 21, 2019 8:38 pm

Convex Decomposition Issue with OBJ File

Post by Pappers » Thu Feb 21, 2019 8:50 pm

So recently I have been trying to modify Bullet's ImportOBJ demo (in Bullet 3) and the ConvexDecomposition demo (in Bullet 2.79, 2.80, etc.) by simply moving the attached objects into the specified directory and then changing the filepath to the objects specified.

The demos can find and detect the file, but the resulting convex hull is either incorrect or non-existent. In the case of the hand.obj, the resulting convex hull appears to be a line, and in the cup object (obj.obj), there doesn't seem to be a resulting convex hull. I have tried and uploaded other object files and they appear to work with the demo, but I want to figure out why exactly these two object files aren't properly decomposed.

To replicate this scenario, you can do the following:

For bullet version 2.79, 2.80, ... (pre-Bullet 3 I believe):

In main.cpp of Demos/ConvexDecompositionDemo:

Code: Select all

int main(int argc,char** argv)
{
        const char* filename = "0.obj.obj"; //Or 0.hand.obj


        ConvexDecompositionDemo* convexDecompDemo = new ConvexDecompositionDemo();

        convexDecompDemo->initPhysics(filename);
        
        // The rest is the same
        
In ConvexDecompositionDemo.cpp of Demos/ConvexDecompositionDemo:

Code: Select all

//Lines 79 to 82

void ConvexDecompositionDemo::initPhysics()
{
	initPhysics("0.obj.obj");
}

// Scroll further down the file...

// Lines 177 to 191

#ifndef NO_OBJ_TO_BULLET

	ConvexDecomposition::WavefrontObj wo;

	tcount = wo.loadObj(filename);

	if (!tcount)
	{
		//when running this app from visual studio, the default starting folder is different, so make a second attempt...
		tcount = wo.loadObj("../../0.obj.obj");
	}
	if (!tcount)
	{
		//cmake generated msvc files need 4 levels deep back... so make a 3rd attempt...
		tcount = wo.loadObj("../../../../0.obj.obj");
	}
	
// The rest should be the same
For Bullet 3, I believe the demo is called lImportObjDemo in Importers. Alternatively, there is also a ConvexDecomposition demo. Both of them still generate a convex hull that lacks any collision, and the coordinates of the hull itself is incorrect.
Attachments
Obj.zip
OBJ Files that I am trying to display
(42.95 KiB) Downloaded 8 times

Post Reply