0

Camera Settings

Anonymous 10 years ago 0
This discussion was imported from CodePlex

SagarDabas wrote at 2013-02-10 06:08:

Sir, Can you please tell me how to manipulate camera. I want to change lots of things in the default camera. Like
  1. the camera rotation should be done programmatically not mouse.
  2. the camera rotates along only y-axis.
  3. the axis of rotation can be changed.
And, also this thing returns NULL == > myHelixViewPort.CameraController.

Please, it's really very urgent. And thank you for such an awesome product.

objo wrote at 2013-02-10 16:11:

Wish I could help you, but I don't think this is within the scope of this library. But constraints on the camera position/look direction is planned (issue 9979 and 9961).
Maybe animations of the camera properties can help in your case, see msdn.

The CameraController is null until the control template is applied. Should not be null after that. Maybe you try to access the property too early?

SagarDabas wrote at 2013-02-11 15:07:

Thanks for the reply,
I solved my first problem by simulating mouse inputs ... but I am still not able to understand when should I try to access property ....
This was the code
public partial class MainWindow : Window
    {
        
        public MainWindow()
        {
            InitializeComponent();
            CameraController controller = this.myViewPort3D.CameraController;
            if(controller == null)   Console.WriteLine("Controller is null");
            DataContext = this;
        }    
    }
and the output is "controller is null". When should I access this property , I am just a beginner. I am not able to figure out whether ControlTemplate is applied or not . Please answer

objo wrote at 2013-02-11 16:52:

Wait until the Window is loaded. Subscribe to the Loaded event on the Window:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.loaded.aspx

SagarDabas wrote at 2013-02-11 17:42:

Ohh, thank you so much. I extended the library and modified some Visuals so easily. Thanks for such a good product.