BtHeightfieldTerrainShape working wrong

Post Reply
mrev1l1
Posts: 3
Joined: Fri Jul 24, 2015 10:07 am

BtHeightfieldTerrainShape working wrong

Post by mrev1l1 »

I have a problem with BtHeightFieldTerrainShape
I'm trying to create a terrain with it. Here is my code:

Code: Select all

unsigned char heightfield[16]={
0,3,6,9,
0,3,6,9,
0,3,6,9,
0,3,6,9
};
....
btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, -1, 0)));

auto groundShape = new btHeightfieldTerrainShape(4, 4, heightfield, 9, 1, false, false);

btVector3 inertia(0, 0, 0);
int mass = 0;

btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(mass, groundMotionState, groundShape, inertia);
auto groundRigidBody = new btRigidBody(groundRigidBodyCI);

m_dynamicsWorld->addRigidBody(groundRigidBody);

m_shapes.push_back(std::unique_ptr<btCollisionShape>(groundShape));
m_rigidBodies.push_back(std::unique_ptr<btRigidBody>(groundRigidBody));
states.push_back(std::unique_ptr<btMotionState>(groundMotionState));
So I'm trying to create a simple plain terrain with an angle. But it's not working properly.
Post Reply