我有一個帶有一些立方體的ModelVisual3D。如果我想旋轉整個組的中心,我該怎麼做?ModelVisual3D的中心
這裏是我的代碼:
RotateTransform3D rt;
AxisAngleRotation3D ar;
Transform3DGroup grp;
rt = new RotateTransform3D();
ar = new AxisAngleRotation3D();
ar.Axis = new Vector3D(1, 0, 0);
ar.Angle = x; //x a value 0-360
rt.Rotation = ar;
rt.CenterX = //*Here i need the center of the ModelVisual3D X*
rt.CenterY = //*Here i need the center of the ModelVisual3D Y*
rt.CenterZ = //*Here i need the center of the ModelVisual3D Z*
grp = new Transform3DGroup();
grp.Children.Add(rt);
cubes.Transform = grp; //cubes is the ModelVisual3D object that i want to rotate
歡迎計算器!提供示例代碼的簡短說明總是更好,以提高發布準確性:) – 2012-11-02 01:46:53