Skip to content

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

Open
@pignugget23

Description

@pignugget23

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions