Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pignugget23 opened this issue Oct 29, 2024 · 0 comments

Comments

@pignugget23
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant