Bullet Physics Engine を使用して、btGImpactMeshShape を使用して OBJ モデルをワールドにロードします。このエンジンを使用するのは初めてです。
これが私のコードです
//---------------------------------------//
// load from obj //
//---------------------------------------//
ConvexDecomposition::WavefrontObj wobj;
printf("load first try"); fflush( stdout );
std::string filename("bunny.obj");
int result = wobj.loadObj( "bunny.obj" );
if(!result)
{
printf("first try fail\n"); fflush( stdout );
printf("load second try"); fflush( stdout );
result = wobj.loadObj("../bunny.obj");
}
printf("--load status %d\n", result );
printf("--triangle: %d\n", wobj.mTriCount);
printf("--vertex: %d\n", wobj.mVertexCount);
btTriangleIndexVertexArray* colonVertexArrays = new btTriangleIndexVertexArray(
wobj.mTriCount,
wobj.mIndices,
3*sizeof(int),
wobj.mVertexCount,
wobj.mVertices,
3*sizeof(float)
);
btGImpactMeshShape* bunnymesh = new btGImpactMeshShape(colonVertexArrays);
bunnymesh ->setLocalScaling( btVector3(0.5f, 0.5f, 0.5f) );
bunnymesh ->updateBound();
startTransform.setOrigin( btVector3(0.0, 0.0, 0.0) );
startTransform.getBasis().setEulerZYX( 0, 0, 0 );
localCreateRigidBody( bunnymesh , startTransform, 0.0 );
printf("Load done...\n");
ロードしたモデルはこちら .............. このバニーは MAC 上の MeshLab を使用して表示されました
さまざまなストライド パラメータを変更しようとしましたが、これは私のプログラムの結果です
コードの何が問題なのか提案はありますか?