1

I have taken a look at Helix-3d examples, specifically a Manipulator Example and I tried to reproduce the functionality in C#.

I have a Window with HelixViewport3D and the following code:

 public partial class TransformWindow : Window
{
    public TransformWindow()
    {
        InitializeComponent();

        BoxVisual3D box = new BoxVisual3D();
        Point3D position = new Point3D(3,4,5);
        box.Center = position;
        Viewport3D.Children.Add(box);
        TranslateManipulator manipulator1 = new TranslateManipulator();
        manipulator1.Bind(box);
        manipulator1.Color = Colors.Red;
        manipulator1.Direction = new Vector3D(1,0,0);
        manipulator1.Diameter = 0.1;
       //manipulator1.Position = position; 
        Viewport3D.Children.Add(manipulator1);
    }
}

This code adds arrow that I can use to move the box, but the manipulator arrow is positioned in the center of the viewport. I would like it to protrude out of the box. If I use the position to position it initially, then the initial position is correct, but manipulator arrow stays put as I move the object. How can I make manipulator stay correctly positioned (protruding from object at all time)?

Dan
  • 11,077
  • 20
  • 84
  • 119
  • OK, I think I have the answer. Basically, the problem is with setting the position. Box should not be set into initial position using Center, but should be transformed into new position. That way, both the manipulator and box start life at the same point and will continue moving in unison. – Dan Feb 12 '15 at 20:05

1 Answers1

1

You can do this by changing this:

Point3D position = new Point3D(3,4,5);

To this:

Point3D.Transform = new TranslateTransform3D( new Vector3(3,4,5) );

In first case you get the mesh position changed not the Transform position That is why your transform control is bound to origin

MRW
  • 81
  • 1
  • 4