Using a mouse with a first person view.

I searched around a ton looking for a good explaination of how to get a mouse working in a First person shooter style game. I have created a scene in a warehouse with boxs in it. I use the camera as the character view, and I also made a arm that is parented to the camera in front of the camera view holding a gun. I can only use the keyboard for turning and looking around and such. I need to know how I can impliment the use of the mouse to control the camera and later to control the aim of the gun. If I understand correctly I need a python script to use the mouse. Any help would be GREAT! :slight_smile: maybe a link to a good up to date tutorial too.

Thanks, :smiley:

Quadron

I got this script for my shooter:

import GameLogic
import Rasterizer

ww = Rasterizer.getWindowWidth()
wh = Rasterizer.getWindowHeight()

aspect = float(wh)/ww

actionx=25.0
actiony=actionx*aspect

c = GameLogic.getCurrentController()
sensor = c.getSensor(“mouse”)
owner = c.getOwner()

owner.x = float(sensor.getXPosition()-ww/2)/wwactionx
owner.y = float(sensor.getYPosition()-wh/2)/wh
actiony

owner.setPosition([owner.x,0,-owner.y])

lol if we had a quid (buck, whatever) for everytime that question was asked AND answered, we’d be millionaires by now! :stuck_out_tongue:

Keith. 8)

Soon I’ve got a bunch of blender sources for the game engine. And then you can say, just look at Blended Reality.

But ok, Blended Reality is still not released, so I grap a source with a little tutorial with it, zipped and uploaded for you. Link: http://home.tiscali.nl/jdvhulst/elysiun/mouselook.zip

i wrote my own mouselook and mouseover scripts anyway.

I got a blend with it +move +jump :smiley:

http://www.angelfire.lycos.com/vamp/jallaballa/MOUSE.blend

Yeah, this question should be added to the FAQ.

Thanks for the replies :slight_smile:

Question #1 How would I put the script that Gelutu gave me into the game? What else would I have to do to make it work?

Question #2 Would all of this work for a 3rd person veiw following a player as well? Such as in jedi academy or a 3rd person shooter.

Thanks,

Quadron