Hi
There seems to be a
problem for the collision detection algorithm to detect collision between
spheres and cylinders. I have made a model of a nice little tractor. The
contact geometries of the front wheels are made of cylinders, while the rear
wheels are made from convex hulls (inspired by the soil-bin demo).
The ground consists of four boxes which forms the walls for the soil model, which is just a lot of spheres. When the simulation starts, the tractor is situated on one of the boxes (Figure 1). There is no problem of contact detection between front wheels and ground at this stage.
When the front wheels
reach the soil model (spheres) they just fall through (Figure 2). There is
nothing wrong with the contact families which I have defined because the contact
is working for the rear wheels (Figure 3). I have seen similar behavior with
simpler models; a cylinder falling on a box of spheres.
// Add contact geometry
myWheel->GetCollisionModel()->ClearModel();// A cylinder has problems colliding with spheres
myWheel->GetCollisionModel()->AddCylinder(radius, radius, width,
ChVector<>(0, 0, ContOffset), Q_from_AngX(CH_C_PI_2));// Generate a convex hull
std::vector<ChVector<>> ConvexPoints;
const int n = 21;
ConvexPoints.resize(n * 2);
for (int i = 0; i < n; i++){
double V = i * CH_C_PI * 2 / 21;
ChVector<>Pt1(radius*cos(V), radius*sin(V), 0.5 * width);
ConvexPoints[i] = Pt1;
ChVector<>Pt2(radius*cos(V), radius*sin(V), -0.5 * width);
ConvexPoints[i + n] = Pt2;
}
myWheel->GetCollisionModel()->AddConvexHull(ConvexPoints, ChVector<>(0,0, ContOffset));myWheel->GetCollisionModel()->BuildModel();
myWheel->SetCollide(true);