none
Click event in 3d object

    Question

  • Hai,

         I need to set events for the clickable portions in a 3d object. I converted the .3ds file into xaml file and i took the mesh positions(Positions, Normals) of that 3d object. I have loaded all the mesh positions inside MeshGeometry3D tag as mesh_0, mesh_1... to get the whole 3d object.

       Now i need to set clickable event for the meshes inside that MeshGeometry3d tag. Is it possible? If so how can i do that? Give me some suggestions regarding this.

     
    Regards,
    Anitha.N

    Friday, June 27, 2008 4:11 AM

All replies

  • You may want to try out the VisualTreeHelper.HitTest(...) method, supplying your Viewport3D as the "reference" parameter and your mouse coords as well.  The hit test will return the model that was clicked.

    In WPF 3.5, there is a ModelUIElement3D class that may make things easier, but I have not tried that yet.

    -Jer
    Friday, June 27, 2008 7:32 AM
  • Hai Morill,
        
       I have tried Both VisualHelper.Hit Test and MouseUIElement3d. By using them both i done the click event for whole mesh only. But i need to have events for every particular location in the mesh... Can u tel me regarding this?

    Regards,
    Anitha.N
    Friday, June 27, 2008 4:03 PM
  • -> By using them both i done the click event for whole mesh only. But i need to have events for every particular location in the mesh... Can u tel me regarding this?

    I am not particularly clear what you mean by this? do you want to calculate the currently clicked position in 3D space or something different?

    Thanks
    Monday, June 30, 2008 7:19 AM
  • Hai,

        I have made click events for the whole mesh inside the viewport. If i click anywhere inside the viewport, an event occurs(like messagebox.show). But i need to make various click event, for every particular location of mesh inside the viewport. Can u tell me how it can be done?

    Regards,
    Anitha.N

    Tuesday, July 01, 2008 3:05 AM
  • -> But i need to make various click event, for every particular location of mesh inside the viewport.

    I still cannot understand which feature you are requesting, 3D hit test mechanism can hit test against each MeshGeometry3D instances, but it seems that you need something different.

    Thanks
    Tuesday, July 01, 2008 5:47 AM