1

I know that a ModelVisual3D can be rotated around any axis via AxisAngleRotation3D, but is it possible to do the same with Viewport3D that contains 9 ModelVisual3Ds, so they are rotated together as if they are one object.. for example I can do this with ModelVisual3D:

<Viewport3D.Triggers>
       <EventTrigger RoutedEvent="Viewport3D.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation 
                  Storyboard.TargetName="myVerticalRotation"
                  Storyboard.TargetProperty="Angle"
                  From="0" To="360" Duration="0:0:10"
                  RepeatBehavior="Forever" />
                            <DoubleAnimation 
                  Storyboard.TargetName="myHorizontalRotation"
                  Storyboard.TargetProperty="Angle"
                  From="0" To="360" Duration="0:0:9"
                  RepeatBehavior="Forever" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Viewport3D.Triggers>

but this presumes that Viewport3D contains only one ModelVisual3D

mshwf
  • 7,009
  • 12
  • 59
  • 133

1 Answers1

1

Yes, it's possible by containing all GeometryModel3D objects inside a Model3DGroup inside ModelUIElement3D inside ContainerUIElement3D, and then we're able to define the RotateTransform3D in ContainerUIElement3D.Transform:

 <ContainerUIElement3D>
                    <ModelUIElement3D>
                        <Model3DGroup>
                            <GeometryModel3D>...</GeometryModel3D>
                            <GeometryModel3D>...</GeometryModel3D>
                            <GeometryModel3D>...</GeometryModel3D>
                        </Model3DGroup>
                    </ModelUIElement3D>
                    <ContainerUIElement3D.Transform>
                      <Transform3DGroup>
                        <RotateTransform3D >
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D  x:Name="myHorizontalRotation" Angle="142.884" Axis="0 1 0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                     </Transform3DGroup>
                   </ContainerUIElement3D.Transform>
            </ContainerUIElement3D>
mshwf
  • 7,009
  • 12
  • 59
  • 133