我用子彈物理引擎使用btGImpactMeshShape .. 加載OBJ模型世界我很新的使用該引擎使用子彈物理加載OBJ模型btGImpactMeshShape但結果是錯誤的
這裏是我的代碼
//---------------------------------------//
// 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觀察的模型我試圖改變各種參數的步幅,然而,這是從我的程序
的結果,你有什麼建議,有什麼不好的代碼?
感謝您的建議。但是,我怎麼能設置指針浮動。問題與我的模型有關嗎?或者我必須更改我的代碼的任何部分。 – MooMoo