Im trying to move some objects around, i can set_pos of my meshes (NodePath) successfully, but the default camera wont move… this is what i have:
NodePath static0 = window->load_model(framework.get_models(), "test.obj");
static0.set_pos(LVector3::zero); //this works fine
Camera* cam = window->get_camera(0);
cam->get_transform()->set_pos(LVector3(3000.f, 50.f, 0.f)); //this not
This should move the camera far away but it keeps fixed on place looking the model…
What is the correct way to manipulate the camera position & rotation?
Thanks for answering…
I tried the window->setup_trackball(); it allows me to use mouse to manipulate the camera, as i don`t want that, i removed that line from my code, so my program is not running with it…
From the link you submit, i noticed there is no Camera* pointer as used type, the example is using NodePath for camera, and get the camera as follows:
camera = window->get_camera_group();
So this line :
camera = window->get_camera(0);
does not returns me a manipulable camera… isn`t ? This means i need to understand the concept of a Camera object and NodePath…
Thanks, it is an useful content…
get_camera_group() practically is the NodePath that contains the main camera…
get_camera(0) is just a PandaNode isn´t ?
OK you explained well…
What I really do not understand is, why do I need to access a node that contains multiples cameras rather than choosing only the camera I want to manipulate…
Moving window->get_camera(0) has a lot o more sense than moving window->get_camera_group() to translate the camera 0…
Moving the group of cameras makes me feel than I’m moving all my camera…
I fully agree with you, please note that the approach used in the official manual is not always correct. It is better to give examples for a tutorial with a newly created camera than to refer to the basic one. This will only confuse.
i guess got success creating a new camera by doing this:
Camera* cam = new Camera("My_Camera");
NodePath ncam = window->make_camera().attach_new_node(cam);
ncam.set_pos(LVector3(0.f, 50.f, 50.f));
Only think i need to do is to set it as current camera, switch from default to this newly created because i still see rendering the default one…
I think this path involves the creation of another display region. However, it is better to use
In Panda, it often happens that methods or classes are not well named.
I was thinking about it and you were right…
CameraGroup (a NodePath: this should be the parent of the followings nodes)
Camera (a PandaNode : child of CameraGroup NodePath)
SomeAudioNode (a PandaNode : chile of CameraGroup NodePath)
The group in this case is CameraGroup, maybe the name get_camera_group means that i’m accessing the Nodepath for the default camera group, not a group of all cameras!..
Don’t make it more sense ?
I have previously published the PandaNode classes schema.
Schematic structure of the PandaNode. Perhaps someone will be useful.
TreePandaNode.zip (8.4 KB)
│ ├── MouseRecorder
│ ├── AnalogNode
│ ├── ButtonNode
│ ├── DialNode
│ ├── TrackerNode
│ ├── VirtualMouse
│ ├── MouseAndKeyboard
│ ├── MouseInterfaceNode
│ │ ├── DriveInterface
│ │ ├── MouseSubregion
│ │ └── Trackball
│ ├── ButtonThrower
│ ├── MouseWatcher
│ ├── Transform2SG
│ └── InputDeviceNode
│ └── AmbientLight
As for NodePath, think of it as a handle for classes.
This is getting more and more sense…
I completely forgot about PandaNode and the nodes described here.