|
错误的地方请看红色注释,不知道为什么,也不能追踪源码
NxBodyDesc BodyDesc;
BodyDesc.angularDamping = 0.5f;
BodyDesc.linearDamping =0.1f;
NxActorDesc ActorDesc;
ActorDesc.body = &BodyDesc;
ActorDesc.density = density;
ActorDesc.globalPose.t = position;
//定义凸体形状描述
NxConvexShapeDesc *ShapeDesc=new NxConvexShapeDesc[n];
for (int i=1;i<=n;i++)
{
char id[255];
char *PhysXFileName1=new char[255];
strcpy(PhysXFileName1,PhysXFileName);
strcat(PhysXFileName1,itoa(i,id,10));
strcat(PhysXFileName1,".obj");
NxConvexShapeDesc ShapeDesc1;
//获取凸体网格模型
ShapeDesc[i-1].meshData =CreateDynamicModels(PhysXFileName1,i);
ShapeDesc[i-1].materialIndex =MetalMaterialIndex;
ActorDesc.shapes.pushBack(&ShapeDesc[i-1]);
delete[] PhysXFileName1;
if (i==n)
{
//这一句提示访问内存错误,奇怪的很
actorName=gScene->createActor(ActorDesc);
actorName->raiseBodyFlag (flag);
}
} |
|