From 9099d6bed52a9315659e89451b90af0d19aab676 Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Wed, 27 Jun 2007 19:12:09 +0000 Subject: [PATCH] updated vehicle demo to load heightfield data from file --- Demos/VehicleDemo/VehicleDemo.cpp | 42 +++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/Demos/VehicleDemo/VehicleDemo.cpp b/Demos/VehicleDemo/VehicleDemo.cpp index 662995157..bc69ad78f 100644 --- a/Demos/VehicleDemo/VehicleDemo.cpp +++ b/Demos/VehicleDemo/VehicleDemo.cpp @@ -130,7 +130,10 @@ void VehicleDemo::setupPhysics() m_dynamicsWorld->setDebugDrawer(&debugDrawer); //m_dynamicsWorld->setGravity(btVector3(0,0,0)); +btTransform tr; +tr.setIdentity(); +//either use heightfield or triangle mesh //#define USE_TRIMESH_GROUND 1 #ifdef USE_TRIMESH_GROUND int i; @@ -199,28 +202,53 @@ const float TRIANGLE_SIZE=20.f; bool useQuantizedAabbCompression = true; groundShape = new btBvhTriangleMeshShape(indexVertexArrays,useQuantizedAabbCompression); + tr.setOrigin(btVector3(0,-4.5f,0)); + #else //testing btHeightfieldTerrainShape int width=128; int length=128; unsigned char* heightfieldData = new unsigned char[width*length]; + { + for (int i=0;isetLocalScaling(localScaling); + tr.setOrigin(btVector3(0,-64.5f,0)); + #endif // - btTransform tr; - tr.setIdentity(); - tr.setOrigin(btVector3(0,-4.5f,0)); + +