Hi!
i try to translate a python code into a c++ code but I have done something wrong. The python code is this:
md = base.win.getPointer(0)
x = md.getX()
y = md.getY()
rotVel = 0.2
if base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2):
base.cam.setH(base.cam.getH() - (x - base.win.getXSize()/2)*rotVel)
base.cam.setP(base.cam.getP() - (y - base.win.getYSize()/2)*rotVel)
i have written this:
NodePath mouse = framework.get_window(0)->get_mouse();
int x = mouse.get_x();
int y = mouse.get_y();
GraphicsWindow* gw = framework.get_window(0)->get_graphics_window();
NodePath cam_group = framework.get_window(0)->get_camera_group();
if (gw->move_pointer(0, gw->get_properties().get_x_size()/2, gw->get_properties().get_y_size()/2)) {
cam_group.set_h(cam_group.get_h() - (x - gw->get_properties().get_x_size()/2 * VEL_ROT));
cam_group.set_p(cam_group.get_p() - (y - gw->get_properties().get_y_size()/2 * VEL_ROT));
}
These are not the same code: with the c++ code my environment jumps to the right and left at random (maybe is the camera that rotates?)
Where is the error?
thansk!