Setting Initial Camera Position


I’d like to change a scene’s initial camera position.

I realise that in order to do this I need to disable the mouse. How do I do this?



Hi. In C++ it’s the other way around, default mouse camera control is turned off by default and if you wanted to turn it on you’d have to do:


So in your case you don’t have to do anything.

It’s part of the Hello World tutorial, btw (switch to C++): … the_Camera

The problem is that I want to use the mouse as well. As soon as I call


the camera gets repositioned.

You have to get a pointer to the Trackball object, then you can call set_pos() on that object to reposition the camera where you want it. Use something like this:

NodePath tballnp = window->get_mouse().find("**/+Trackball");
PT(Trackball) trackball = DCAST(Trackball, tballnp.node());
trackball->set_pos(x, y, z);

Or even:



Ah sorry, I thought you didn’t want to use the trackball facility and just use mouse input to move the camera the “manual” way, in a task. Check the Mouse Support chapter when you need to change to that, it’s translated to C++.

Thanks, that’s fixed the problem.