01-23-2024, 08:47 AM
Yes, there were many problems because the same Visual3D was used as a group of objects and also provides its own GeometryModel3D. Therefore this was prevented and you will need to split this into three objects (adding one to group both boxes):
Code:
//var visualGroup = new ModelVisual3D(); // Standard WPF object to group other Visual3D objects
var visualGroup = new ContentVisual3D(); // ContentVisual3D also allows to show or hide the content by setting IsVisible property
MainViewPort3D.Children.Add(visualGroup);
BoxVisual3D b = new BoxVisual3D();
b.Size = new Size3D(1000,1000, 1000);
b.Material = new DiffuseMaterial(new SolidColorBrush(Colors.Gold));
b.CenterPosition = new Point3D(0, 2000, 0);
visualGroup.Children.Add(b);
visualGroup.Children.Add(new BoxVisual3D(){Size = new Size3D(500,500,500),CenterPosition = new Point3D(0,0,0),Material = b.Material});
Andrej Benedik

