MouseMove - FPS Mouselook & Movement Script

(Riyuzakisan) #1

================================
Project Discontinued
As of January 2015, this project has been discontinued.

The latest version of the script has been posted on GitHub, and is released under public domain, so feel free to modify and distribute it as you see fit. I currently have no plans to continue development on this project.

MouseMove - A Mouselook & Movement Script Version: 2.7 Released: March 19th, 2013
   Made with [Blender](http://www.blender.org/) 2.66.1 (<i>r55075:55077</i>)

This script is designed to be quick to set up and easy to customize, and offers a Mouselook system and two optional Player movement features.

 <i><b>Features included in this script:</b></i>
  • Mouselook system
  • Two player movement systems (Static and Dynamic)
  • Property Hooks - Easily customize how the script works by using Object Properties; No programming required!
  • Import, run, and change properties from inside your own script!

Download & GitHub Page:
https://github.com/Riyuzakisan/MouseMove

0 Likes

(Riyuzakisan) #2

Updated the main post now.

0 Likes

(vieau6) #3

Works great,thanks!

0 Likes

(Riyuzakisan) #4

Updated the files, the movement functions require a keyboard: all keys (true pulse) sensor for now. I removed the requirement of the always sensor, so it only activates the code on direct input.

0 Likes

(filanek) #5

Hi Riyuzakisan,
thanks for this script, it works well, but when I tried to replicate your scene from a scratch the dynamic box does not move correctly. It moves shortly, only when I press forward button or continuously only when mouse is moving in the same time. Please, could you have a look what can be wrong? here is the blend
thanks,
f

0 Likes

(Riyuzakisan) #6

Just make sure you enable True Pulse https://lh3.googleusercontent.com/_DFvJNtBvuLM/TZJdTb03dhI/AAAAAAAAARE/TNv9YgRoUUE/s800/truePulse.png for the keyboard sensor. This goes for both the Force and Loc movement (it’s listed in the instructions in those sections of the script)

True Pulse will send a pulse to the controller depending on the frequency (which in this case should be left at default: 0 ). If true pulse isn’t enabled and you press a keyboard key, it just sends the initial positive pulse followed by the negative pulse when you release the key. True pulse mode keeps the positive pulses constantly flowing as long as the sensor is active.

In your file, the reason it moves when you move your mouse is because once you hold the key down and it sends its single pulse to the controller, the mouse sensor which is also connected to that controller sends its own pulses to run the script, which finds that the key is being pressed.

Oh and by the way, you might consider reorienting your camera so it’s facing the forward direction of your player cube, it seems a bit off :wink:

0 Likes

(Riyuzakisan) #7

I should also add that, unless you’re testing the Mouselook property configuration or planning on changing those properties in game, you don’t need to add properties such as Enable, Cursor, or Invert and leave them all to their default settings. The defaults are defined in the script in case the properties aren’t added to the camera. Just noticed you had added those, not sure if you were testing them out or not :stuck_out_tongue:

0 Likes

(filanek) #8

Thanks a lot, it helped, I am very new in BGE, bought the environment tutorial from cgmasters and now making first tests, trying to add movement camera. And yeah after purely copied your scene (except the true pulse) I realized I dont need property config!:wink:
cheers,
F

0 Likes

(Riyuzakisan) #9

Here’s a minor update (v2.1)
I noticed that the camera would somehow start slightly rotating on its local Y axis and causing an awkward tilted view, so I’ve limited that from happening. Download link updated in the original post.

0 Likes

(Tythorr) #10

Wooo been trying to find something like this for quite a while now, this has helped me lots! Thanks for the post!

0 Likes

(blender dragon) #11

for some reason when i click run script it tells me to look in the console can someone help me ps i am new to blender

0 Likes

(Riyuzakisan) #12

You need to be using the Game Engine (logic bricks), not the Run Script button. See the picture in my first post that shows the minimal logic brick setup.

0 Likes

(blender dragon) #13

thank you and thanks for the mouselook script this is the only place i found it for the 2.57b

0 Likes

(blender dragon) #14

how do i keep the camera from going all the way around so i could see behind me

0 Likes

(polygobblerr) #15

Wow! Just what iv been waiting for :smiley: This will work well for doing a fly-through of an environment. Thanks!

0 Likes

(blender dragon) #16

fixed the cap did it

0 Likes

(Riyuzakisan) #17

@blender dragon: I’m not sure what you’re asking

0 Likes

(lucaba) #18

Your demo file works well, but when I make an own file with your script and move the mouse the camera turns upside down. I used the minimal configuration
Thanks

0 Likes

(Riyuzakisan) #19

Sorry for the delay in response. Could you post your blend file? I might be able to figure out what’s wrong.

Also, did you check the console for errors? Let me know if it says anything about indentation errors by chance.

0 Likes

(ahandgesture) #20

How do I get the texture/color of the objects I am using to carry over into the game?

0 Likes