How to make a group out of several objects

Anonymous 9 years ago 0
This discussion was imported from CodePlex

afra89 wrote at 2011-12-23 12:17:

I have several CubeVisual3D objects. Can I somehow make them a single group and then I rotate that group so all of the cubes rotate. Is this possible?

afra89 wrote at 2011-12-23 12:41:

Thanks for quick answer, it works.
The problem is that I want to rotate them in the center of the whole modelgroup. 

This is my code:

RotateTransform3D rt;         
AxisAngleRotation3D ar;           
Transform3DGroup grp;

rt = new RotateTransform3D();           
ar = new AxisAngleRotation3D();                       
ar.Axis = new Vector3D(1, 0, 0);           
ar.Angle = x;           

rt.Rotation = ar;           
rt.CenterX = *Here i need center of the group X*       
rt.CenterY = *Here i need center of the group Y*           
rt.CenterZ = *Here i need center of the group Z*

grp = new Transform3DGroup();           
cubes.Transform = grp; 

objo wrote at 2011-12-23 12:50:

here is a great book on 3D programming with WPF:


the mathematics behind transformations is well covered here!