BulletSim: fix problem with not convex hulling large objects by creating unit meshes and always scaling in Bullet

bulletsim
Mic Bowman 2011-08-05 14:53:39 -07:00
parent c3f579046c
commit 82f41fdcb5
1 changed files with 5 additions and 3 deletions

View File

@ -1013,8 +1013,8 @@ public sealed class BSPrim : PhysicsActor
// m_log.DebugFormat("{0}: CreateGeom: calling CreateHull. lid={1}, key={2}, hulls={3}", LogHeader, _localID, _hullKey, hullCount); // m_log.DebugFormat("{0}: CreateGeom: calling CreateHull. lid={1}, key={2}, hulls={3}", LogHeader, _localID, _hullKey, hullCount);
BulletSimAPI.CreateHull(_scene.WorldID, _hullKey, hullCount, convHulls); BulletSimAPI.CreateHull(_scene.WorldID, _hullKey, hullCount, convHulls);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL; _shapeType = ShapeData.PhysicsShapeType.SHAPE_HULL;
// meshes are already scaled by the meshmerizer // Let the object be scaled by Bullet (the mesh was created as a unit mesh)
_scale = new OMV.Vector3(1f, 1f, 1f); _scale = _size;
} }
return; return;
} }
@ -1138,7 +1138,9 @@ public sealed class BSPrim : PhysicsActor
if (_scene.NeedsMeshing(_pbs)) // linksets with constraints don't need a root mesh if (_scene.NeedsMeshing(_pbs)) // linksets with constraints don't need a root mesh
{ {
// m_log.DebugFormat("{0}: RecreateGeomAndObject: creating mesh", LogHeader); // m_log.DebugFormat("{0}: RecreateGeomAndObject: creating mesh", LogHeader);
_mesh = _scene.mesher.CreateMesh(_avName, _pbs, _size, _scene.MeshLOD, _isPhysical); // Make the mesh scaled to 1 and use Bullet's scaling feature to scale it in world
OMV.Vector3 scaleFactor = new OMV.Vector3(1.0f, 1.0f, 1.0f);
_mesh = _scene.mesher.CreateMesh(_avName, _pbs, scaleFactor, _scene.MeshLOD, _isPhysical);
} }
else else
{ {