Mouse Emulation Support

Seth Steiling
Posts: 1365
Joined: Fri Jun 27, 2008 11:29 am
Location: Corvallis, Oregon

Re: Mouse Emulation Support

Post by Seth Steiling »

[quote=baggyg]However I am currently working on a freePIE profile for controller emulation so that on any game (looking at you skyrim) you can use the trackIR for looking around combined with controller for movement. Will post script here when I have something I am happy with. [/quote]
I'm definitely interested in seeing what you come up with. Please do keep us posted.
Marketing Manager
TrackIR | OptiTrack
baggyg
Posts: 21
Joined: Tue Apr 02, 2013 6:31 am
Location: Slovakia

Re: Mouse Emulation Support

Post by baggyg »

Ok - this was relatively easy. Some points to start
#The screens will obviously not show the bindings - you must learn these
#Skyrim is not a great example as there are far too many buttons (controller mode doubles up on these depending on the context). A standard fps would be far easier to do. Feel free to adapt as you see fit. Ive not played a lot of Skyrim so wasnt wholly sure what could be left out.
#There are 3 multipliers to adjust
-xbox yaw sensitivity (g_yawSensitivityMultiplier)
-xbox pitch sensitiviy (g_pitchSensitivityMultiplier)
-trackIR sensitivity (g_trackIRMultiplier)
#source available here: http://www.grantbagwell.co.uk/xbox-trackir-skyrim.py
Skyrim freePIE / trackIR / Xbox 360 Controller script:

Code: Select all

def update():
		
	#LMouseClick  Attack with weapon or cast spell in right hand (primary hand maps to primary mouse)
	mouse.leftButton = xbox360.rightTrigger
	#RMouseClick  Attack with weapon or cast spell in left hand / Block if available
	mouse.rightButton = xbox360.leftTrigger

	#E      Activate/use/hold to manipulate objects
	keyboard.setKey(Key.E, xbox360.x)
	
	#Alt    Sprint
	keyboard.setKey(Key.LeftAlt, xbox360.rightShoulder)
	
	#Shift  Walk (slower and quieter than default movement)
	keyboard.setKey(Key.LeftShift, xbox360.b)
	
	#Space  Jump
	keyboard.setKey(Key.Space, xbox360.a)
	
	#Ctrl   Crouch/sneak mode
	keyboard.setKey(Key.LeftControl, xbox360.leftShoulder)
	
	#R      Ready/sheathe weapon	
	keyboard.setKey(Key.R, xbox360.leftThumb)
	
	#F      Change views (1st and 3rd person)
	keyboard.setKey(Key.F, xbox360.y)
	
	#Tab    Character Menu
	keyboard.setKey(Key.Tab, xbox360.back)
	
	#Esc    Menu
	keyboard.setKey(Key.Escape, xbox360.start)
		
	#J      Open journal
	keyboard.setKey(Key.J, xbox360.rightThumb)
	
	#P      Magic menu
	keyboard.setKey(Key.P, xbox360.up)
	
	#M      Map	
	keyboard.setKey(Key.M, xbox360.left)
	
	#I      inventory
	keyboard.setKey(Key.I, xbox360.down)
	
	#T      Wait		
	keyboard.setKey(Key.T, xbox360.right)
	
	#Q      Favorites
	#C      Toggle Automove / Zoom item in inventory			
	#/      Perk menu
	#Z      Racial power/Dragon shout	
	#Mwheel  Scroll in menus or zoom while in 3rd person
	#1-8    Hotkeys (no numpad) - Not supported
	#`      Open/close the console (~ key) - not supported
	
	#Movement	
	keyboard.setKey(Key.A, xbox360.leftStickX < -0.2) #strafe-left
	keyboard.setKey(Key.S, xbox360.leftStickY < -0.2) #backward
	keyboard.setKey(Key.D, xbox360.leftStickX > 0.2) #strafe-right
	keyboard.setKey(Key.W, xbox360.leftStickY > 0.2) #forward	
	
	#Track IR Movement
	yaw = trackIR.yaw
   	pitch = trackIR.pitch

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

	#MouseLook
	mouse.deltaX = (xbox360.rightStickX*g_yawSensitivityMultiplier) + (-deltaYaw*g_trackIRMultiplier)
	mouse.deltaY = (-xbox360.rightStickY*g_pitchSensitivityMultiplier) + (deltaPitch*g_trackIRMultiplier)
   
if starting:
	global g_yawSensitivityMultiplier, g_pitchSensitivityMultiplier 
	g_yawSensitivityMultiplier = 1.5
	g_pitchSensitivityMultiplier = 1.3
	g_trackIRMultiplier = 17
	freeTrack.update += update
baggyg
Posts: 21
Joined: Tue Apr 02, 2013 6:31 am
Location: Slovakia

Re: Mouse Emulation Support

Post by baggyg »

It goes without saying this could also work by using a program such as XPadder. However this represents a good "open source" solution and means you are handling both trackIR and the Xbox controller in the same place.
Seth Steiling
Posts: 1365
Joined: Fri Jun 27, 2008 11:29 am
Location: Corvallis, Oregon

Re: Mouse Emulation Support

Post by Seth Steiling »

Would you be willing to make a demo video of this in action?
Marketing Manager
TrackIR | OptiTrack
baggyg
Posts: 21
Joined: Tue Apr 02, 2013 6:31 am
Location: Slovakia

Re: Mouse Emulation Support

Post by baggyg »

Hi Seth,

I would be happy to make a video here, but what in particular are you looking to see. There are already a couple around showing Skyrim working with trackIR, so are you looking for something instructional on how to setup or just a demo of how cool it looks :-)
Nixxen
Posts: 1
Joined: Wed May 01, 2013 7:44 am
Location: Norway

Re: Mouse Emulation Support

Post by Nixxen »

I'm a bit confused on what you actually managed to do.

Is it an emulated mouse, or did you actually manage to get a "free head movement" kind of setup - and that without any skyrim mods?


If it's the latter one, then in theory one should be able to set Skyrim up to play like ArmA, correct?
baggyg
Posts: 21
Joined: Tue Apr 02, 2013 6:31 am
Location: Slovakia

Re: Mouse Emulation Support

Post by baggyg »

Its an emulated mouse. Skyrim would need a pretty clever mod to separate head movement. By plugging trackIR in Vireio Perception drivers (using the sharedMemoryTracker) you can also achieve roll although the 3d is not as good as 3D Vision / helix. However if you are looking for a 2D solution this is the best way to go. It probably also is the most likely route to introduce separate head movement in the future with the advances of the Rift.
Post Reply