This mouselook works perfectly well on Blender 2.48a, and it’s capped. It doesn’t lock like the old IPO mouselook, and the cap seems to be always at the same point; you set it up the same way as in the original one. Enjoy.
# - Mouselook Script
import Rasterizer as r
c=GameLogic.getCurrentController()
o=c.getOwner()
if hasattr(o, 'x')==0:
o.x=0.0
mouse=c.getSensor("mouse")
lmotion=c.getActuator("leftright")
wmotion=c.getActuator("updown")
sens=0.0006
posx=(r.getWindowWidth()/2-mouse.getXPosition())*sens
posy=(r.getWindowHeight()/2-mouse.getYPosition())*sens
if o.x<=-1 and posy<0 or o.x>=1 and posy>0:
posy = 0.0
o.x+=posy
lmotion.setDRot(0,0,posx,1)
wmotion.setDRot(posy,0,0,1)
GameLogic.addActiveActuator(wmotion,1)
GameLogic.addActiveActuator(lmotion,1)
r.setMousePosition(r.getWindowWidth()/2,r.getWindowHeight()/2)
I’ve made the script again to make it shorter. It’s only 29 lines now!
If you look at the FPS template now, with 2.48a, at startup the mouselook is locked on an axis, which is really annoying for players, and they may not like the game. They’d think the programmers are lazy if they see they can roll forever…
Oto,
If you open the fps template with Blender 2.48a, you should see that when it starts you can’t move by the Z-axis; this could be annoying for players and give them a bad idea about the game…
Hello!
I can use u script in my scenes?
I like much this! very better that Templere walktroug that i was used.
Of couse the credit for this will be you ^^
Bye ^^
I love how smooth this is and thanks for all the hard work in scripting. I do have one question though. Any idea how to remove the post movement drifting?
B3D00, I don’t see a mouselook script in this, but aim.py. I assumed that your script was to replace this one, but they have different actuators. Did you add different actuators to yours before writing the script?
Edit: Nevermind, I’m an idiot. I thought this was a page in another topic I was looking at. Thanks for the script, and ignore that previous statement.