I recently tried to modify the collision example found here:
http://www.panda3d.org/manual/index.php/Pusher_Example. My goal was to update the collision ray with setFromLens() and pick the objects with the mouse.
This wasn´t that hard and i tried to implement the same with a orbital camera script (rotating,moving and zooming) found here: [url]Another Camera Controller, Orbit style]. It all works fine at the beginning but as soon as i rotate the camera i can´t pick the objects on the screen anymore.
I think there must be something like rotating also the mouse-positions to fit the new orientation of the lens but I absolutely don´t know how and cant find anything related to this problem.
This is the little function i wrote to update the screen ray:
def ray_update(self):
if base.mouseWatcherNode.hasMouse():
mpos = base.mouseWatcherNode.getMouse()
# This makes the ray's origin the camera and makes the ray point
# to the screen coordinates of the mouse.
#self.pointerNode.setPos(base.camera.getPos())
self.raySolid.setFromLens(base.camNode, mpos.getX(), mpos.getY())