I am writing a mouse look script. I know I could use an already made script, but I like to make most of my code so I can understand it and learn. One thing that I haven’t been able to figure out though, is how to stop it from looking all the way above the character and then being upside down infront. This is a third person script by the way.
import Rasterizer as r import GameLogic as gl import mathutils as m cont=gl.getCurrentController() own = cont.owner sensUPDOWN=.0009 sensLEFTRIGHT=.0009 mouse=cont.sensors['Mouse'] updown=cont.actuators['updown'] leftright=cont.actuators['leftright'] pivot = gl.getCurrentScene().objects['cam_pivot2'] #r.showMouse(True) # extract width and height from gameScreen width = r.getWindowWidth() height = r.getWindowHeight() # distance moved from screen center x = int(width/2) - mouse.position y = int(height/2) - mouse.position r.setMousePosition(int(width/2), int(height/2)) updown.dRot=[y*sensUPDOWN,0,0] leftright.dRot=[0,0,x*sensLEFTRIGHT] cont.activate(updown) cont.activate(leftright) #angle capping #works in 2.57
pivot is an empty that controls up and down movement. Thank you for any help.