Python mouse

I`m new to python, in python how can i make the Y axis of a mouse
rotate a object. The y+ y-

If you take a look at the API you’ll notice that SCA_MouseSensor has an attribute position (frame coordinates). The same thing with SCA_PythonMouse or bge.logic.mouse, except here position are the frame coordinates normalized.

A mouse script works like this: when the mouse cursor is in the center of the screen before you move the mouse the position will be shifted. By getting this difference and centering the mouse cursor on every logic tic, the difference values can be used for motion. So actually you just need a mouse script.

from bge import logic

rot_speed = 0.5

def center_mouse():
    logic.mouse.position = [0.5, 0.5]

def get_mouse_position():
    return [0.5 - round(i, 2) for i in logic.mouse.position]

def rotate(own, mouse_position):
    rot = mouse_position[1] * rot_speed
    own.applyRotation([0, 0, rot], True)

init = True
def main(cont):
    center_mouse()
    global init
    if init:
        init = False
        return
    own = cont.owner
    mouse_position = get_mouse_position()
    rotate(own, mouse_position)

Info Redacted

Yeah looks really good, i will try this bro.
Can you remove the link please :slight_smile: