CameraController not defined

Dec 21, 2011 at 9:07 PM


Hi! I need to add HelixView3D on my form in the code. so, run-time error:: "cameracontroller not defined". What should I do?

Dec 21, 2011 at 9:44 PM

Are you using an old version? The control has been renamed to HelixViewport3D.

Are you calling any methods on the control before the control template has been applied? (the camera controller is undefined until the template is applied).

In what part of the code are you adding the control?

Is it possible to create the control in the view XAML? See the examples.

Dec 21, 2011 at 10:13 PM

this is my code.. i have to add HVP3D dynamically..

[] AllFiles = Directory.GetFiles(@"C:\Users\..", "*.3ds"); HelixViewport3D[] hel_ar = new HelixViewport3D[AllFiles.Count()]; for (int i = 0; i < AllFiles.Count(); i++) { hel_ar[i] = new HelixViewport3D(); PerspectiveCamera myPCamera = new PerspectiveCamera(); myPCamera.Position = new Point3D(10000, 0, 0); myPCamera.LookDirection = new Vector3D(-1, 0, 0); myPCamera.FieldOfView = 60; hel_ar[i].Viewport.Camera = myPCamera; DirectionalLight myDirectionalLight = new DirectionalLight(); myDirectionalLight.Color = Colors.White; myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61); hel_ar[i].Viewport.Height = 115; hel_ar[i].Viewport.Width = 115; Model3DGroup m3d = new Model3DGroup(); m3d = ModelImporter.Load(AllFiles[i]); m3d.Children.Add(myDirectionalLight); ModelVisual3D m = new ModelVisual3D(); m.Content = m3d; hel_ar[i].Viewport.Children.Add(m); stackPanel1.Children.Add(hel_ar[i]); }

Dec 21, 2011 at 10:22 PM

Thanks, i did it

Jan 28, 2012 at 3:52 PM

One more question..

I create HelixViewport3D in C# code and import 3ds model. When i run project, HelixViewport does not show anything until doubleMMB.

What should i do to fix it? i want helixviewport to show my model at once.

Jan 29, 2012 at 9:20 AM

It seems like your camera position/look direction is wrong. Try to use the ZoomExtents or ResetCamera method in HelixViewport3D after importing the 3ds model.

There is currently not a "ModelLoaded" event on the FileModelVisual3D, I think that is something that should be added.