Player Mouselook

Beginners often have problems with Mouselook and parenting cameras and so have I.

I think this blend is a fairly simple method that works. Also I think it’s best to build and leave your player/ camera at the origin and place them where you want them at runtime with an initialization script.

Edit: W to walk, Spacebar to fly.


PlayerMouseLook.blend (418 KB)

I did a tutorial on how to create a simple mouselook script, if anyone is interested:

PS: Maybe this thread belongs in the resources forum?

I posted it mainly as a reply to rudm who’d already hijacked a thread on this forum. My tutorial such as it is probably isn’t deserving of a place in resources.

Edit: Hi Goran. I watched your tutorial. It’s good. And of course I’ve read CThames script. But not everyone wants or needs to know about writing functions and classes, not straight away anyway. My script is tiny and easily understood and the blend comes with DummyCam, slow parent and a cursor at no extra charge.

P.P.S: I can probably fix the drift if it occurs by chucking in an abs() somewhere but I can’t be arsed looking at it now.

P.P.P.S: Of course, it’s the “//” thing like you said in your tut. Replace the six instances of “/2” with “//2”. Thanks Goran.

Thank you, Equip. Still I wondering why in my script camera start falling along Z Axis. If someone could answer that would be great help.


Trying to move mouse.blend (415 KB)

I think the problem you’re having is that at start up the mouse is unlikely to be centered. My blend has a script Init that runs once at start up to center the mouse.

You might as well use my blend. The look script is almost the same and you are going to want to parent your camera to an object anyway so that you can move around the scene using the parents local axes. In my blend I’ve made the parent dynamic so you can use some physics if want climb stairs and stuff.

Just remember to set the Player and the DummyCam to non-renderable in Outliner.

Thank you very much. I’ll use your script.