Controlling camera with mouse

I am currently making a first-person shooter in Blender 2.35, and I want to know how to control the camera rotation by moving the mouse. I have absolutely no experience with Python.

Here. It requires python, but its a very good tutorial, so don’t worry. Also, there are plenty of good tutorials (including Blender-GE Python) on that site.

A good starting point is to check out the FPS template in

Well, i tried J09’s tutorial, but when I press P the camera goes crazy. Help?

Post the script you used, its probably that you’re rotating the camera too much.

import Rasterizer

controller = GameLogic.getCurrentController()

player = controller.getOwner()

mouse = controller.getSensor(“Mouse”)

lookLeftRight = controller.getActuator(“LookLeftRight”)
lookUpDown = controller.getActuator(“LookUpDown”)

width = Rasterizer.getWindowWidth()
height = Rasterizer.getWindowHeight()

def mouseMove():
x = width/2 - mouse.getXPosition()
y = height/2 - mouse.getYPosition()

if hasattr(player, 'mouseInit') == False:
	x = 0
	y = 0
	# bug in Add Property
	# can't use True.  Have to use 1
	player.mouseInit = 1

return (x, y)

move = mouseMove()

sensitivity = 0.0005

leftRight = move[0] * sensitivity
upDown = move[1] * sensitivity

lookLeftRight.setDRot( 0.0, 0.0, leftRight, False)
lookUpDown.setDRot( upDown, 0.0, 0.0, True)

GameLogic.addActiveActuator(lookLeftRight, True)
GameLogic.addActiveActuator(lookUpDown, True)

Rasterizer.setMousePosition(width/2, height/2)