From 4ce4465cc72e598ef6c88455f6dbba5155c9738c Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Mon, 16 Jun 2014 01:39:44 +0100 Subject: [PATCH] Fix vehicle collision triangles --- rwengine/src/objects/VehicleObject.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rwengine/src/objects/VehicleObject.cpp b/rwengine/src/objects/VehicleObject.cpp index 8a23958a..98aa7661 100644 --- a/rwengine/src/objects/VehicleObject.cpp +++ b/rwengine/src/objects/VehicleObject.cpp @@ -44,13 +44,13 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos, const glm: // Spheres for( size_t i = 0; i < physInst.spheres.size(); ++i ) { auto& sphere = physInst.spheres[i]; - btCollisionShape* sshape = new btSphereShape(sphere.radius); + btCollisionShape* sshape = new btSphereShape(sphere.radius/2.f); btTransform t; t.setIdentity(); t.setOrigin(btVector3(sphere.center.x, sphere.center.y, sphere.center.z)); cmpShape->addChildShape(t, sshape); } - if( false && physInst.vertices.size() > 0 && physInst.indices.size() >= 3 ) { + if( physInst.vertices.size() > 0 && physInst.indices.size() >= 3 ) { btTriangleIndexVertexArray* vertarray = new btTriangleIndexVertexArray( physInst.indices.size()/3, (int*) physInst.indices.data(), @@ -59,9 +59,9 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos, const glm: &(physInst.vertices[0].x), sizeof(glm::vec3)); btBvhTriangleMeshShape* trishape = new btBvhTriangleMeshShape(vertarray, false); - btTransform t; - t.setOrigin(com); - cmpShape->addChildShape(t,trishape); + trishape->setMargin(0.09f); + btTransform t; t.setIdentity(); + cmpShape->addChildShape(t, trishape); } btVector3 inertia(0,0,0);