Questions icon indicating copy to clipboard operation
Questions copied to clipboard

minecraft doesnt recognise logitech G29 wheel turning input (https://shorturl.at/QOgdQ) (original code) (minecraft java 1.21.3)

Open pignugget23 opened this issue 1 year ago • 0 comments

import pygame import time from pynput.mouse import Controller as MouseController

pygame.init() mouse = MouseController() pygame.joystick.init()

print("Press Ctrl+C to exit.")

joystick_count = pygame.joystick.get_count() if joystick_count == 0: print("No joystick detected.") pygame.quit() exit()

joystick = pygame.joystick.Joystick(0) joystick.init() print(f"Joystick initialized: {joystick.get_name()}")

try: while True: for event in pygame.event.get(): if event.type == pygame.JOYAXISMOTION:

            if event.axis == 0:  
                steering_wheel = event.value
                print(f"Steering Wheel Position: {steering_wheel:.2f}")

              
                if abs(steering_wheel) > 0.1:  # Deadzone
                    mouse_movement_x = steering_wheel * 100  # Sensitivity factor
                    mouse.move(int(mouse_movement_x), 0)
                    print(f"Mouse moved by: {int(mouse_movement_x)}")

    time.sleep(0.01)

except KeyboardInterrupt: print("Exiting...") finally: pygame.quit()

pignugget23 avatar Oct 29 '24 21:10 pignugget23