Third Person Camera Questions

I had a few questions about a 3rd person camera setup. I’m looking at modifying the Roaming Ralph example.

Basically what I want to do is three things, ending up with WASD+Mouse style movement.

First, the mouse controlled camera. I think I’m in the ballpark with this:

                if base.mouseWatcherNode.hasMouse():
            base.camera.setY(base.camera, ((base.mouseWatcherNode.getMouseY() - self.lastMouseY) *(elapsed * 100)))
            base.camera.setX(base.camera, ((base.mouseWatcherNode.getMouseX() - self.lastMouseX) *(elapsed * 100)))
            self.lastMouseY = base.mouseWatcherNode.getMouseY()
            self.lastMouseX = base.mouseWatcherNode.getMouseX()

But, it only moves so far before I run out of window. There’s bound to be a better way of doing it, likely involving locking the cursor to the window, and/or getting changes in cursor position instead of absolute position. But, I’m unsure of how to do that.

The second is turning the character as the camera rotates. I figure that this is linked to rotating the camera, but I’m still unsure how I should manage the character + camera setup.

Third, I’d like to have crosshairs, and fire off collision-rays aimed at the spot through the crosshairs. But, I’m not sure how I’d go about designing a system to do such. (Maybe having the master node controlling the model, hitbox and camera originating the point? Eventually aiming it from a bone in the gun-barrel.)

A lot of this is probably pretty newbie-ish, but I do appreciate the help.
[/code]

i think most third person cameras are design to just follow what every objects they are tied too.

So make your avatar move around and look at stuff and your camera just follow it. The code that you show is more akin to a FPS style camera.