tags:

views:

106

answers:

0

I have a pretty simple 3D scene that is roughly built up like this:

<Viewport3D>
  <ModelVisual3D>
    <ModelVisual3D.Content>
        <Model3DGroup x:Name="Group1">
          <GeometryModel3D x:Name="m1">...</GeometryModel3D>
        </Model3DGroup>
        <Model3DGroup x:Name="Group2">
          <GeometryModel3D x:Name="m2">...</GeometryModel3D>
        </Model3DGroup>
        <Model3DGroup x:Name="Group3">
          <GeometryModel3D x:Name="m3">...</GeometryModel3D>
        </Model3DGroup>
    </ModelVisual3D.Content>
  </ModelVisual3D>
</Viewport3D>

And basically each of the 3 GeometryModel3D's has its own Mesh, Transforms, etc...

When I do hit testing on the Viewport3D, all I ever get is the point in 3D space that I clicked when I hit something. What I really am after, is the point ON the mesh that I hit in 3D space (not a single Point on the mesh, but rather the Point3D).

The goal for me is to add a new Material to the clicked on Mesh at the exact point that the user clicks. And I cannot do that if I only have access to the Point3D relative to the Viewport3D (because of all the transforms on the meshes etc...)

An example might be that the m1 Geometry is a rectangle like shape, with some slight rotations and transformed up the Y axis so its at the top of the screen.

When I click on the VERY bottom of the mesh, I would like to get the X-Y (Z not needed here) point relative to the local coordinate space of that mesh...

I hope that all makes sense, and thanks for any help you can give

Mark