Hey, if you guys copy/paste the code into your own blend file, you make sure to use Format > Convert Whitespaces > To spaces in the Text Editor, right? Sometimes the indentation of the code gets messed up when pasting from the clipboard, so that may cause the problem with the camera turning upside down. Try checking the console for error messages if it happens again.
Can you add a cap on the x axis, or a function to āfreezeā the x axis?
I have a cutscene and the player must be able to turn his head (but not too much) on the x axis.
About the console, there are no error: only Blender Game Engine Started and Finished
A cap function for the X axis is pretty much freezing it. This can be done. Iām currently working on fixing another bug so Iāll add cap functions for the other axes after that. Sorry for the delay in the response :o
Update time! There are some major changes in the script, some involving changes to Property hooks. If you are using this script for either of the Movement systems, youāll need to update your property names and values.
Changes:
Fixed the camera flipping upside down (Thanks to SolarLune for help on this)
Changed the names of the Location Movement properties
Removed Force Movement and replaced it with the more realistic Dynamic Movement system
New Dynamic Movement Features:
Player can only change directions when in contact with the ground
Player can only jump (once) when in contact with the ground
Player slides slightly after you stop moving
Sneaking (Shift) makes the player slower
Cannot jump while sneaking (or crouching, if you prefer to call it that)
Note: I forgot to include Shift in the Dynamic Movement control tips (in the instructions)
Latest Version: 2.2 (8/28/11; 2:20pm)
Download:
MouseLook_Demo.blend
Alternate Download:
Thank you! Now my camera doesnāt go upside down.
Also, sorry for not being able to add in the cap for looking left and right. I think it would be too hard to determine which angle would be the initial angle and then limit rotation from that. What you could do instead is write a script to get the angle of that axis and when it reaches your own specified limits you can switch the mouselook scriptās āEnableā property to False.
Original Post updated with the Instructions Manual section. Instructions are also included with the script.
Hello Riyuzakisan,
Thanks for the awesome script!
I have a question: how would I go about changing the keys for wasd movement? Iād prefer if they were the arrow keys instead, or better yet, configurable.
Thanks,
Ryan
Thatās a good idea, Iāll see about adding in some configuration options for those. The simplest way is to have some presets, like WASD, IJKL, and Arrow Keys; Iām not sure how else they could be easily defined by the user without running into some problems.
Hereās a question for you about the custom movement controls. If you were using arrow keys for Location Movement, what keys would you use to fly up/down? They are normally E and Q.
Iād say Q and A since theyāre easy to find without looking (on US keyboards at least).
Or maybe Insert and Delete which are very close to the arrow keys. That may not be the case at all for laptops though.
Q or A might work, I was also thinking of Z and X which might be better since theyāre laid out horizontally. Iām guessing arrow key control would be easier for left handed users, but it kind of lacks those fly controls. What would be ideal for left handed users is probably the IJKL controls, then you have U and O for flying.
Hi im having a problem with this, when i use W it jumps and spacebar dont work ?
On your version it works perfect but on mine it dont please help
I see, this is because of the new movement system Iāve added. I should add the ability to fly then.
I made the new movement system to be more realistic:
-The player canāt move forward while mid-air unless they were already moving before jumping
-The player canāt jump unless they are touching the ground
A fly option should fix this easily.
any way you can help me out mate ?
Not at the moment, itās late. It would take a while to program in. You could try using the location movement system for the time if you want to fly around.
Nah i dont want to fly around, i just want to do what your fps does but on my own level and im having problems :>
So wait, W makes it jump, not space? I canāt help you there, it seems youāre having your own technical difficulties. Could you be clear on exactly whatās going wrong again?
Yes when i press W it jumps, S and Spacebar do nothing, But in your file it works perfect.
I dont mind using your file but i have already made my level and would like to start again.
what difficulties would i be having ?
Open the Console window (Help > Toggle console) and type or paste a screenshot of any errors it might have. If it doesnāt have any errors, I have no idea whatās going on. Iāve copy/pasted my script into other blend files for use, and itās worked fine.