/// Add a box shape to this model, for collision purposes public override bool AddBox( double hx, /// the halfsize on x axis double hy, /// the halfsize on y axis double hz, /// the halfsize on z axis ChVector pos, /// the position of the box COG ChMatrix33 <double> rot /// the rotation of the box - matrix must be orthogonal ) { // adjust default inward margin (if object too thin) this.SetSafeMargin(ChMaths.ChMin(this.GetSafeMargin(), 0.2 * ChMaths.ChMin(ChMaths.ChMin(hx, hy), hz))); float ahx = (float)(hx + this.GetEnvelope()); float ahy = (float)(hy + this.GetEnvelope()); float ahz = (float)(hz + this.GetEnvelope()); BoxShape mshape = new BoxShape(new IndexedVector3(ahx, ahy, ahz)); mshape.SetMargin((float)this.GetSuggestedFullMargin()); _injectShape(pos, rot, mshape); return(true); }