
How to make a group out of several objects
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?
objo wrote at 2011-12-23 12:22:
See
http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.modelvisual3d.children.aspx
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();
grp.Children.Add(rt);
cubes.Transform = grp;
objo wrote at 2011-12-23 12:50:
here is a great book on 3D programming with WPF:
http://www.amazon.com/Programming-Windows-Three-Dimensional-Presentation-Foundation/dp/0735623945
the mathematics behind transformations is well covered here!
Customer support service by UserEcho