public IConvexHullShapeImp AddConvexHullShape(float3[] points, bool optimized) { var btPoints = new Vector3[points.Count()]; for (int i = 0; i < btPoints.Count(); i++) { var point = Translater.Float3ToBtVector3(points[i]); btPoints[i] = point; } var btConvexHullShape = new ConvexHullShape(btPoints); //btConvexHullShape.LocalScaling = new Vector3(3, 3, 3); if (optimized == true) { var btShapeHull = new ShapeHull(btConvexHullShape); var margin = btConvexHullShape.Margin; btShapeHull.BuildHull(margin); ConvexHullShape simplifiedConvexShape = new ConvexHullShape(btShapeHull.Vertices); BtCollisionShapes.Add(simplifiedConvexShape); var retval = new ConvexHullShapeImp(); retval.BtConvexHullShape = simplifiedConvexShape; simplifiedConvexShape.UserObject = retval; return retval; } else { BtCollisionShapes.Add(btConvexHullShape); var retval = new ConvexHullShapeImp(); retval.BtConvexHullShape = btConvexHullShape; btConvexHullShape.UserObject = retval; return retval; } }
public IConvexHullShapeImp AddConvexHullShape() { var btConvexHullShape = new ConvexHullShape(); BtCollisionShapes.Add(btConvexHullShape); var retval = new ConvexHullShapeImp(); retval.BtConvexHullShape = btConvexHullShape; btConvexHullShape.UserObject = retval; return retval; }