Manipulator demo

  • Open the "ExampleBrowser" application to run this example.
  • The source code can be found in Source\Examples\ExampleBrowser\Examples\Manipulator

This application demonstrates how to use manipulators in a scene.

manipulatordemo.png

XAML
        <ht:HelixViewport3D Camera="{ht:PerspectiveCamera 20,10,10}" ZoomExtentsWhenLoaded="True">
            <ht:SunLight/>

            <ht:SphereVisual3D x:Name="sphere1" Center="-4,0,0" Fill="Orange"/>
            <ht:TranslateManipulator Color="Black" Position="-4,0,0" Offset="0,0,1" Length="1" Value="{Binding Radius, ElementName=sphere1}" Direction="0,0,1"/>

            <ht:BoxVisual3D x:Name="box1" Center="-8,0,0" Fill="Orange"/>
            <ht:TranslateManipulator Color="Black" Position="-8,0,0" Offset="0,0,0.5" Length="1" Value="{Binding Height, ElementName=box1, Converter={StaticResource Multiplier}}" Direction="0,0,1"/>
            <ht:TranslateManipulator Color="Black" Position="-8,0,0" Offset="0,0.5,0" Length="1" Value="{Binding Width, ElementName=box1, Converter={StaticResource Multiplier}}" Direction="0,1,0"/>
            <ht:TranslateManipulator Color="Black" Position="-8,0,0" Offset="0.5,0,0" Length="1" Value="{Binding Length, ElementName=box1, Converter={StaticResource Multiplier}}" Direction="1,0,0"/>

            <ht:RectangleVisual3D x:Name="plane2" Origin="0,0,0" Normal="1,0,0" LengthDirection="0,1,0" Fill="Gray"/>
            <ht:RotateManipulator Color="Green" Axis="0,1,0" Transform="{Binding Transform, ElementName=plane2}" TargetTransform="{Binding Transform, ElementName=plane2}" Diameter="1"/>
            <ht:RotateManipulator Color="Blue" Axis="0,0,1" Transform="{Binding Transform, ElementName=plane2}" TargetTransform="{Binding Transform, ElementName=plane2}" Diameter="1"/>
            <ht:TranslateManipulator x:Name="planeManipulator" Color="Red" Transform="{Binding Transform, ElementName=plane2}" TargetTransform="{Binding Transform,ElementName=plane2}" Direction="1,0,0"/>

            <ht:CubeVisual3D x:Name="cube1" Transform="{ht:Translate 4,0,2}" Fill="Gold"/>
            <ht:CombinedManipulator TargetTransform="{Binding Transform, ElementName=cube1}"/>

            <ht:CubeVisual3D x:Name="cube2" Transform="{ht:Translate 4,-4,1}" Fill="Silver"/>
            <ht:CombinedManipulator CanTranslateX="False" CanTranslateY="False" CanTranslateZ="False" TargetTransform="{Binding Transform, ElementName=cube2}"/>

            <ht:CubeVisual3D x:Name="cube3" Transform="{ht:Translate 4,4,1}" Fill="#cd7f32"/>
            <ht:CombinedManipulator CanRotateX="False" CanRotateY="False" CanRotateZ="False" TargetTransform="{Binding Transform, ElementName=cube3}"/>

            <ht:RectangleVisual3D Fill="#800000FF"/>            
        </ht:HelixViewport3D>

Last edited Jun 15, 2012 at 3:45 AM by objo, version 3

Comments

No comments yet.