Skip to content

A script that maps steering wheel and pedal controls to mouse and keyboard controls.

Notifications You must be signed in to change notification settings

BassimGh/SteeringWheel-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

This script maps steering wheel and pedal controls to mouse and keyboard controls.

How?

Mouse movement

  1. Pygame captures steering wheel movement
  2. This function takes the steering output that ranges from -1 to 1 and maps it to a desired mouse movement value based on a specified range (range depends on sensitivity preference)
def map(val, min1, max1, min2, max2):
    range1 = max1 - min1
    range2 = max2 - min2
    
    scale = range2 / range1
    return (val - min1) * scale + min2
  1. Pynput Moves mouse by value received from map function

Mouse clicking

  1. Pygame captures steering wheel gear shifts
  2. Pynput simulates left and right mouse button cicks

Keyboard control

  1. Pygame captures steering button presses and foot pedal movement
  2. Pynput simulates keyboard key presses for steering wheel and foot pedal controls pressing gas pedal would press the 'w' key and the brake pedal would press the 's' key to move forward and backward for WASD game movement.

Mapped controls:

Steering/footpedal input Mouse/keyboard output
gearshift up left click
col 2 is right click
right turn right mouse-x movement
left turn left mouse-x movement
upward hat switch placement upward mouse-y movement
downward hat switch placement downward mouse-y movement
gas pedal 'w' key
break pedal 's' key
break pedal 's' key

Demo

4tg1db

4tg0c6

About

A script that maps steering wheel and pedal controls to mouse and keyboard controls.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages