mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 11:22:45 +01:00
Fix vehicle collision triangles
This commit is contained in:
parent
7063952d56
commit
4ce4465cc7
@ -44,13 +44,13 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos, const glm:
|
|||||||
// Spheres
|
// Spheres
|
||||||
for( size_t i = 0; i < physInst.spheres.size(); ++i ) {
|
for( size_t i = 0; i < physInst.spheres.size(); ++i ) {
|
||||||
auto& sphere = physInst.spheres[i];
|
auto& sphere = physInst.spheres[i];
|
||||||
btCollisionShape* sshape = new btSphereShape(sphere.radius);
|
btCollisionShape* sshape = new btSphereShape(sphere.radius/2.f);
|
||||||
btTransform t; t.setIdentity();
|
btTransform t; t.setIdentity();
|
||||||
t.setOrigin(btVector3(sphere.center.x, sphere.center.y, sphere.center.z));
|
t.setOrigin(btVector3(sphere.center.x, sphere.center.y, sphere.center.z));
|
||||||
cmpShape->addChildShape(t, sshape);
|
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(
|
btTriangleIndexVertexArray* vertarray = new btTriangleIndexVertexArray(
|
||||||
physInst.indices.size()/3,
|
physInst.indices.size()/3,
|
||||||
(int*) physInst.indices.data(),
|
(int*) physInst.indices.data(),
|
||||||
@ -59,9 +59,9 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos, const glm:
|
|||||||
&(physInst.vertices[0].x),
|
&(physInst.vertices[0].x),
|
||||||
sizeof(glm::vec3));
|
sizeof(glm::vec3));
|
||||||
btBvhTriangleMeshShape* trishape = new btBvhTriangleMeshShape(vertarray, false);
|
btBvhTriangleMeshShape* trishape = new btBvhTriangleMeshShape(vertarray, false);
|
||||||
btTransform t;
|
trishape->setMargin(0.09f);
|
||||||
t.setOrigin(com);
|
btTransform t; t.setIdentity();
|
||||||
cmpShape->addChildShape(t,trishape);
|
cmpShape->addChildShape(t, trishape);
|
||||||
}
|
}
|
||||||
|
|
||||||
btVector3 inertia(0,0,0);
|
btVector3 inertia(0,0,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user