After some messing around I found out that the bounding box of the heightfield is (0 0 -0),(0 0 0).
When using malloc, even nan apears.
Seems to me, that the heightfield is somehow wrongly initialized.
This is my temporary code for adding heightfield to the physics world:
Code: Select all
collider[16]={0};
collider[0]=2.0f;collider[1]=1.0f;collider[2]=0.0f;collider[3]=0.0f;
collider[4]=0.0f;collider[5]=1.0f;collider[6]=1.0f;collider[7]=0.0f;
collider[8]=0.0f;collider[9]=1.0f;collider[10]=1.0f;collider[11]=0.0f;
collider[12]=0.0f;collider[13]=5.0f;collider[14]=5.0f;collider[15]=0.0f;
btTransform t3;t3.setRotation(btQuaternion(0,0,0));t3.setOrigin(btVector3(0,5,0));//t3.setOrigin(btVector3(0,1,-5));//t3.getBasis
btHeightfieldTerrainShape*terrain1=new btHeightfieldTerrainShape(4,4,(void*)collider,1,-1.0f,10.0f,1,PHY_FLOAT,true);
terrain1->setUseDiamondSubdivision();
btDefaultMotionState*motion1=new btDefaultMotionState(t3);
btRigidBody::btRigidBodyConstructionInfo info1(0.0,motion1,terrain1);
btRigidBody*body1=new btRigidBody(info1);
dynamicsWorld->addRigidBody(body1);