Blocked by Unity?

Official forum for open source FreePIE discussion and development.
Post Reply
User avatar
xhonzi
Binocular Vision CONFIRMED!
Posts: 273
Joined: Wed Mar 31, 2010 3:35 pm
Location: Thornton, CO USA

Blocked by Unity?

Post by xhonzi »

All,
I have a little script I wrote to use the Xbox360 controller to emulate mouse and keyboard for a Unity FPS game that doesn't have controller support. When I run the script and open, say, notepad, I can get the right key presses and the mouse emulation works okay.

As soon as I start the game, neither the keyboard nor the mouse emulation still works. If I alt tab out of the game, the script is still running and emulation works as expected.

Turns out there is some gamepad support in the game- it just sucks. I assume this is stealing ownership of the input and therefore not making it available to FreePie. Anyway around that?

Similarly, any way to hide the gamepad from Unity but not FreePie? That way the poorly mapped controls don't double register (as gamepad and emulated keyboard) for the buttons that are used natively in the game.

Thanks!
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Blocked by Unity?

Post by CyberVillain »

Which unity game? I havent had any problems with any of the Oculus demos I tried
Last edited by CyberVillain on Wed Apr 02, 2014 4:21 pm, edited 1 time in total.
User avatar
xhonzi
Binocular Vision CONFIRMED!
Posts: 273
Joined: Wed Mar 31, 2010 3:35 pm
Location: Thornton, CO USA

Re: Blocked by Unity?

Post by xhonzi »

It's actually a Kickstarter beta I'm testing. My avatar is from that game series: Tex Murphy AKA Project Fedora: https://www.kickstarter.com/projects/te ... a?ref=live.

This is not the first time I've used FreePie, but I'm still pretty much a novice. I'll switch comps and copy in my script.

EDIT: Here's the script. Make fun of it/suggest improvements as you will. But I'm mostly looking for why it doesn't work in game.

Thanks!

Code: Select all

keyboard.setKey(Key.Space, xbox360.a)
keyboard.setKey(Key.Escape, xbox360.start)
keyboard.setKey(Key.E, xbox360.x)
keyboard.setKey(Key.F, xbox360.y)
keyboard.setKey(Key.Tab, xbox360.back)


if xbox360.leftStickX > 0.3:
  keyboard.setPressed(Key.D) 
if xbox360.leftStickX < -0.3:
  keyboard.setPressed(Key.A)
if xbox360.leftStickY > 0.3:
  keyboard.setPressed(Key.W)
  if xbox360.leftStickY > 0.7:
    keyboard.setPressed(Key.LeftShift)
if xbox360.leftStickY < -0.3:
  keyboard.setPressed(Key.S)



if xbox360.rightStickX > 0.1:
  mouse.deltaX = 4 * xbox360.rightStickX
if xbox360.rightStickX < -0.1:
  mouse.deltaX = 4 * xbox360.rightStickX

if xbox360.rightStickY > 0.1:
  mouse.deltaY = 4 * xbox360.rightStickY
if xbox360.rightStickY < -0.1:
  mouse.deltaY = 4 * xbox360.rightStickY


#mouse.deltaX
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Blocked by Unity?

Post by CyberVillain »

Under a killing moon is one of my top adventure games! :D
Really strange, do other Unity games work?
User avatar
xhonzi
Binocular Vision CONFIRMED!
Posts: 273
Joined: Wed Mar 31, 2010 3:35 pm
Location: Thornton, CO USA

Re: Blocked by Unity?

Post by xhonzi »

It's hard to tell since all other Unity games I have on hand already have standard gamepad support. :/

I'll try using my hydra and see what happens there since I know it doesn't natively support that.

Project Fedora, or Tex Murphy Tesla Effect (as it has been renamed) is shipping without Rift support... but I've been pestering them about adding it in an early patch. Wish me luck!
User avatar
xhonzi
Binocular Vision CONFIRMED!
Posts: 273
Joined: Wed Mar 31, 2010 3:35 pm
Location: Thornton, CO USA

Re: Blocked by Unity?

Post by xhonzi »

Here's my hydra script. It similarly does nothing once the game is running. :(

But, as I expected, the game doesn't have any native support.

Code: Select all

keyboard.setKey(Key.Space, hydra[1].one)
keyboard.setKey(Key.Escape, hydra[1].start)
keyboard.setKey(Key.E, hydra[1].three)
keyboard.setKey(Key.F, hydra[1].four)
keyboard.setKey(Key.Tab, hydra[1].two)


if hydra[0].joyx > 0.3:
  keyboard.setPressed(Key.D) 
if hydra[0].joyx < -0.3:
  keyboard.setPressed(Key.A)
if hydra[0].joyy > 0.3:
  keyboard.setPressed(Key.W)
  if hydra[0].joyy > 0.7:
    keyboard.setPressed(Key.LeftShift)
if hydra[0].joyy < -0.3:
  keyboard.setPressed(Key.S)

if hydra[1].joyx > 0.1:
  mouse.deltaX = 4 * hydra[1].joyx
if hydra[1].joyx < -0.1:
  mouse.deltaX = 4 * hydra[1].joyx

if hydra[1].joyy > 0.1:
  mouse.deltaY = 4 * hydra[1].joyy
if hydra[1].joyy < -0.1:
  mouse.deltaY = 4 * hydra[1].joyy
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Blocked by Unity?

Post by CyberVillain »

can you try glovepie just to see if its something with our emulation?
User avatar
xhonzi
Binocular Vision CONFIRMED!
Posts: 273
Joined: Wed Mar 31, 2010 3:35 pm
Location: Thornton, CO USA

Re: Blocked by Unity?

Post by xhonzi »

Good idea. I just have to go download GlovePie. :)
Post Reply

Return to “FreePIE”