我用子弹物理引擎使用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
我试图改变各种参数的步幅,然而,这是从我的程序
的结果,你有什么建议,有什么不好的代码?
感谢您的建议。但是,我怎么能设置指针浮动。问题与我的模型有关吗?或者我必须更改我的代码的任何部分。 – MooMoo