How to move a Helix sphere object in WPF?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm new to Helix and liking it so far, I'm building a WPF app that loads the Helix viewport window inside a panel, I then instantiate a cube (CubedVisual3D) via a create button in WPF and it creates the cube, however when I go to click or drag/move it, it doesn't move around. How do I do this? Best approach?
example image



private void Helix_ViewPort_MouseDown(object sender, MouseButtonEventArgs e) 
{
Console.WriteLine("Mouse down.");
Point mousePos = e.GetPosition(MyViewPort);
PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
HitTestResult result = VisualTreeHelper.HitTest(MyViewPort, mousePos);

RayMeshGeometry3DHitTestResult rayMeshResult = result as
RayMeshGeometry3DHitTestResult;
if (rayMeshResult != null)
{
MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex1]);
mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex2]);
mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex3]);
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
GeometryModel3D marker = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Blue));
}

Console.WriteLine(result);
}









share|improve this question































    0















    I'm new to Helix and liking it so far, I'm building a WPF app that loads the Helix viewport window inside a panel, I then instantiate a cube (CubedVisual3D) via a create button in WPF and it creates the cube, however when I go to click or drag/move it, it doesn't move around. How do I do this? Best approach?
    example image



    private void Helix_ViewPort_MouseDown(object sender, MouseButtonEventArgs e) 
    {
    Console.WriteLine("Mouse down.");
    Point mousePos = e.GetPosition(MyViewPort);
    PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
    HitTestResult result = VisualTreeHelper.HitTest(MyViewPort, mousePos);

    RayMeshGeometry3DHitTestResult rayMeshResult = result as
    RayMeshGeometry3DHitTestResult;
    if (rayMeshResult != null)
    {
    MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex1]);
    mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex2]);
    mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex3]);
    mesh.TriangleIndices.Add(0);
    mesh.TriangleIndices.Add(1);
    mesh.TriangleIndices.Add(2);
    GeometryModel3D marker = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Blue));
    }

    Console.WriteLine(result);
    }









    share|improve this question



























      0












      0








      0








      I'm new to Helix and liking it so far, I'm building a WPF app that loads the Helix viewport window inside a panel, I then instantiate a cube (CubedVisual3D) via a create button in WPF and it creates the cube, however when I go to click or drag/move it, it doesn't move around. How do I do this? Best approach?
      example image



      private void Helix_ViewPort_MouseDown(object sender, MouseButtonEventArgs e) 
      {
      Console.WriteLine("Mouse down.");
      Point mousePos = e.GetPosition(MyViewPort);
      PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
      HitTestResult result = VisualTreeHelper.HitTest(MyViewPort, mousePos);

      RayMeshGeometry3DHitTestResult rayMeshResult = result as
      RayMeshGeometry3DHitTestResult;
      if (rayMeshResult != null)
      {
      MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex1]);
      mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex2]);
      mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex3]);
      mesh.TriangleIndices.Add(0);
      mesh.TriangleIndices.Add(1);
      mesh.TriangleIndices.Add(2);
      GeometryModel3D marker = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Blue));
      }

      Console.WriteLine(result);
      }









      share|improve this question
















      I'm new to Helix and liking it so far, I'm building a WPF app that loads the Helix viewport window inside a panel, I then instantiate a cube (CubedVisual3D) via a create button in WPF and it creates the cube, however when I go to click or drag/move it, it doesn't move around. How do I do this? Best approach?
      example image



      private void Helix_ViewPort_MouseDown(object sender, MouseButtonEventArgs e) 
      {
      Console.WriteLine("Mouse down.");
      Point mousePos = e.GetPosition(MyViewPort);
      PointHitTestParameters hitParams = new PointHitTestParameters(mousePos);
      HitTestResult result = VisualTreeHelper.HitTest(MyViewPort, mousePos);

      RayMeshGeometry3DHitTestResult rayMeshResult = result as
      RayMeshGeometry3DHitTestResult;
      if (rayMeshResult != null)
      {
      MeshGeometry3D mesh = new MeshGeometry3D(); mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex1]);
      mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex2]);
      mesh.Positions.Add(rayMeshResult.MeshHit.Positions[rayMeshResult.VertexIndex3]);
      mesh.TriangleIndices.Add(0);
      mesh.TriangleIndices.Add(1);
      mesh.TriangleIndices.Add(2);
      GeometryModel3D marker = new GeometryModel3D(mesh, new DiffuseMaterial(Brushes.Blue));
      }

      Console.WriteLine(result);
      }






      helix-3d-toolkit






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 18 '18 at 18:31







      zA.

















      asked Nov 22 '18 at 20:02









      zA.zA.

      35




      35
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Please refer to the manipulator demo. There are many demos under helixtoolkit github source.






          share|improve this answer
























          • Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

            – zA.
            Nov 29 '18 at 21:37













          • You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

            – Lance H
            Nov 30 '18 at 1:04











          • I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

            – zA.
            Dec 5 '18 at 21:13











          • github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

            – Lance H
            Dec 6 '18 at 1:52











          • Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

            – Lance H
            Dec 6 '18 at 1:54














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437419%2fhow-to-move-a-helix-sphere-object-in-wpf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Please refer to the manipulator demo. There are many demos under helixtoolkit github source.






          share|improve this answer
























          • Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

            – zA.
            Nov 29 '18 at 21:37













          • You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

            – Lance H
            Nov 30 '18 at 1:04











          • I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

            – zA.
            Dec 5 '18 at 21:13











          • github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

            – Lance H
            Dec 6 '18 at 1:52











          • Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

            – Lance H
            Dec 6 '18 at 1:54


















          0














          Please refer to the manipulator demo. There are many demos under helixtoolkit github source.






          share|improve this answer
























          • Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

            – zA.
            Nov 29 '18 at 21:37













          • You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

            – Lance H
            Nov 30 '18 at 1:04











          • I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

            – zA.
            Dec 5 '18 at 21:13











          • github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

            – Lance H
            Dec 6 '18 at 1:52











          • Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

            – Lance H
            Dec 6 '18 at 1:54
















          0












          0








          0







          Please refer to the manipulator demo. There are many demos under helixtoolkit github source.






          share|improve this answer













          Please refer to the manipulator demo. There are many demos under helixtoolkit github source.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 27 '18 at 7:04









          Lance HLance H

          426169




          426169













          • Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

            – zA.
            Nov 29 '18 at 21:37













          • You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

            – Lance H
            Nov 30 '18 at 1:04











          • I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

            – zA.
            Dec 5 '18 at 21:13











          • github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

            – Lance H
            Dec 6 '18 at 1:52











          • Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

            – Lance H
            Dec 6 '18 at 1:54





















          • Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

            – zA.
            Nov 29 '18 at 21:37













          • You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

            – Lance H
            Nov 30 '18 at 1:04











          • I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

            – zA.
            Dec 5 '18 at 21:13











          • github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

            – Lance H
            Dec 6 '18 at 1:52











          • Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

            – Lance H
            Dec 6 '18 at 1:54



















          Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

          – zA.
          Nov 29 '18 at 21:37







          Unfortunately, a manipulator is not what I'm looking for as it binds to an object. I want the actual object to be moved, and not have some arrow attached to it.

          – zA.
          Nov 29 '18 at 21:37















          You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

          – Lance H
          Nov 30 '18 at 1:04





          You can refer to the mouse down/move/up code in manipulator to understand how it move the object and then implement yourself.

          – Lance H
          Nov 30 '18 at 1:04













          I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

          – zA.
          Dec 5 '18 at 21:13





          I checked out the HelixToolkit github page (github.com/helix-toolkit/helix-toolkit) and it's totally disorganized, just a bunch of convoluted folders leading no where. Do you have a direct link of what your talking about?

          – zA.
          Dec 5 '18 at 21:13













          github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

          – Lance H
          Dec 6 '18 at 1:52





          github.com/helix-toolkit/helix-toolkit/blob/develop/Source/…

          – Lance H
          Dec 6 '18 at 1:52













          Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

          – Lance H
          Dec 6 '18 at 1:54







          Mouse Down -> Get the hitted model and its position from its transform, and a plane perpendicular to the camera look direction. Mouse Move -> Update the transform of the model with TraslationTransform with mouse position delta and the plane. Mouse Up -> Release.

          – Lance H
          Dec 6 '18 at 1:54






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437419%2fhow-to-move-a-helix-sphere-object-in-wpf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?