Keyboard To DK2 for Racer Free Simulator

Official forum for open source FreePIE discussion and development.
Post Reply
QuadCoreMax
One Eyed Hopeful
Posts: 1
Joined: Mon Apr 13, 2015 7:16 am

Keyboard To DK2 for Racer Free Simulator

Post by QuadCoreMax »

Hello,

I just discovered FreePIE recently & being successfully testing it with DK2 + Virtual Destop on some games. It's amazing to get an alternative to Vorpx, Tridef, IZ3D or Virieo.

In Racer simulator, we have the ability to control the car/driver camera from the the keyboard numpad.
Here's the function of camera keyboard keys which I would like to redirect to the DK2 Head Tracker via FreePIE :

Numpad 4 & 6 => Yaw Left & Right
Numpad 8 & 2 => Pitch Up & Down
Numpad - & + => FOV

Numpad 5 => Reset Camera

CTRL + Numpad 4 & 6 => Translation X [Horizontal]
CTRL + Numpad 8 & 2 => Translation Y [Vertical]
CTRL + Numpad 1 & 3 => Translation Z [Back & Forward]

Could some Python expert write such script for us all ?

Thanks a lot

FreePIE Script used for head tracking :

Code: Select all

def update():
	yaw = math.degrees(oculusVR.yaw)
	pitch = math.degrees(oculusVR.pitch)

	deltaYaw = filters.delta(yaw)
	deltaPitch = filters.delta(pitch)

	if (enabled):
		mouse.deltaX = -deltaYaw*multiply
		mouse.deltaY = -deltaPitch*multiply

if starting:
	enabled = True
	multiply = 17
	#oculusVR.center()
	oculusVR.update += update

recenter = keyboard.getPressed(Key.PageDown)
toggle = keyboard.getPressed(Key.PageUp)

if toggle:
	enabled = not enabled

if recenter:
	oculusVR.center()

diagnostics.watch(oculusVR.yaw)
diagnostics.watch(oculusVR.pitch)
diagnostics.watch(oculusVR.roll)
diagnostics.watch(oculusVR.x)
diagnostics.watch(oculusVR.y)
diagnostics.watch(oculusVR.z)
-----------------------
http://www.racer.nl
Post Reply

Return to “FreePIE”