0

Obj files import and cursor position in HelixToolkit.Wpf.SharpDX

Igor 8 years ago updated 8 years ago 2

Hello guys! Thank you for great toolkit!


I have 2 questions, maybe anyone can help me:


First: I want to import obj model (with textures) and display it in Viewport3DX. How to do it correctly?
Now I have next:

ObjReader Reader = new HelixToolkit.Wpf.SharpDX.ObjReader();
List<Object3D> objs = Reader.Read(ModelPath);

After reading objs variable contains near 1000 objects. What shall be the next steps to to display model in viewport?


Second: And one more question: How to receive cursor position in Viewport3DX. Is there some property like CursorPosition in HelixViewport3D?

Thank you in advance!

Hi I created a FileLoadDemo and made a pull request to to get it in HelixToolkit.SharpDx showcasing loading files. You should see it under pull request. Otherwise you can have a look in my repo were it is already merged https://github.com/SiNeumann/helix-toolkit

For the mouseposition, if you want to find if your mouse is over an 3D object you can use find hits like this

private void MainWindow_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
var hits= view.FindHits(e.GetPosition(view));
}

In this case "view" is the Viewport3dx

Hi! First of all many thanks for example! It is very helpful for me!

Regarding mouse position: I need to receive mouse position on the model in coordinates of the model!