I have a script that rotates an empty on it’s X axis via the mouse. Since I am bad with combining math and programming (I know, oxymoron), I was wondering how I could modify the following script.
The rotation is run by a 360 degree ipo, but what I want to do is have the mouse only use the right half of the screen. In other words, I want the mouse to move across the right half of the screen twice instead of running the full length, while keeping the rotation property continuous. This means the full 360 degree rotation will be achieved by moving the mouse across the right half twice.
Here is the script:
import Rasterizer as r import GameLogic as gl cont = gl.getCurrentController() own = cont.getOwner() ##Definables mouse = cont.getSensor("mouse") mouse_x = mouse.getXPosition() win_wid = r.getWindowWidth() win_height = r.getWindowHeight() ## rotX is a float property on the owner object that runs the ipo own.rotX = (float(mouse_x) / float(win_wid)) * 360 if own.rotX > 359.5: set = int((5.5 / 360.0) * win_wid) r.setMousePosition(set, mouse.getYPosition()) if own.rotX < 5: set2 = int((359 / 360.0) * win_wid) r.setMousePosition(set2, mouse.getYPosition())
Any help here would be greatly appreciated! If you need anything clarified just ask!