From 10f51db60f4c438b712810d25f76d650b3097b4e Mon Sep 17 00:00:00 2001 From: Jasper Date: Mon, 17 Nov 2014 18:54:19 +0100 Subject: [PATCH] fixed terrain offset --- physics.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/physics.cc b/physics.cc index 39e55d1..c7cadaf 100644 --- a/physics.cc +++ b/physics.cc @@ -51,6 +51,7 @@ void Physics::addTerrain(int width, int length, float** heightData) } } + highest++; /* heightfield[j*length+i] = heightData[i][j]; if (heightData[i][j] > highest) @@ -61,7 +62,7 @@ void Physics::addTerrain(int width, int length, float** heightData) btRigidBody* tBody = new btRigidBody(0,new btDefaultMotionState(),terrianShape); - tBody->getWorldTransform().setOrigin(btVector3(0,highest/2,0)); + tBody->getWorldTransform().setOrigin(btVector3(0,((float)highest - 1)/2,0)); //tBody->getWoorldTransform().setRotation(btQuaternion(0,0,0,1));