Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on July 07, 2014, 09:44:55 AM

Title: InControl Custom Actions
Post by: jeanfabre on July 07, 2014, 09:44:55 AM
Hi,

 Please find some custom actions to work with InControl. Prefer the "device" based actions, as the "player" based actions are using a layer of abstraction to reference device per player. It's still in progress especially around the device assignment so for less trouble initially go for the "device" based actions

https://hutonggames.fogbugz.com/default.asp?pg=pgWiki&command=view&ixWikiPage=1183

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: Katori on September 04, 2014, 10:30:57 PM
Hi Jean,

Thanks a lot for writing these, InControl is a very neat software. Have you had the time to update these lately? These scripts are incompatible with the current version of Unity, specifically, your InControlManager.cs throws several errors. I have attached a screenshot of them. It would definitely be nice to get these working again, although connecting InControl and PlayMaker via a script-based input manager doesn't seem too hard right now. Thanks again.
Title: Re: InControl Custom Actions
Post by: jeanfabre on September 08, 2014, 07:42:11 AM
Hi,

 ok, I'll have a look this week, can you bump me towards the end of the week if I haven't pushed a new version? check the rss feed (http://feeds.feedburner.com/PlaymakerEcosystem) for news on this.

 Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: jaybury on September 23, 2014, 09:19:29 AM
Hey - I just got PlayMaker last week and instantly had the same problems trying to use the incontrol custom actions.

Do you know when (or even if) this is likely to be fixed? I wanted to get PlayMaker working with my other addons but I can't do anything with InControl right now :)

I emailed the info email address for PlayMaker on 17th September but didn't get a reply as of yet
Title: Re: InControl Custom Actions
Post by: Katori on September 23, 2014, 09:33:09 AM
Hey - I just got PlayMaker last week and instantly had the same problems trying to use the incontrol custom actions.

Do you know when (or even if) this is likely to be fixed? I wanted to get PlayMaker working with my other addons but I can't do anything with InControl right now :)

I emailed the info email address for PlayMaker on 17th September but didn't get a reply as of yet
I'm sure Jean is working on them, in the mean time I've made two actions, one for getting a button press and one for a button release. I'll post them here sometime today. I could probably make a few more, but I'll start with what I have.
Title: Re: InControl Custom Actions
Post by: jeanfabre on October 28, 2014, 01:46:29 AM
Hi,

I made an update.

 https://hutonggames.fogbugz.com/default.asp?W1183

 sorry, didn't make an rss entry, I think I am dropping the rss, it's not convenient and automated enough, and doesn't have enough traction... not sure what's the best way to reach playmaker user to mention all this work, any idea?



Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: chrisnathan1983 on January 15, 2015, 08:28:30 PM
I noticed that the action "Get In Control Device Input Button Down" will not be executed. I've found that if I attach a "Get Mouse Button Down" in the same state, then use the mouse button, the InControl button will start working. I'm not sure if this is a bug, or something unusual on my end.
Any ideas?
Just for reference, I'm using a 360 controller, my device index is -1, tried multiple axis.
EDIT: When I set the device index to 1, it works. I'm curious why -1 (active device) doesn't work.
EDIT 2: By editing the "Get In Control Device Input Button Down" script, copying the following to the OnUpdate() function, it works when the device index is -1.

            if (deviceIndex.Value == -1)
            {
                _inputDevice = InputManager.ActiveDevice;
            }
            else
            {
                _inputDevice = InputManager.Devices[deviceIndex.Value];
            }
Title: Re: InControl Custom Actions
Post by: jeanfabre on January 16, 2015, 02:00:15 AM
Hi,

 that's odd indeed. Maybe  you need to shake the system on start so that the device is detected indeed. Are you windows?

 Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: chrisnathan1983 on January 16, 2015, 02:24:12 AM
Yes, I am on Windows.
Title: Re: InControl Custom Actions
Post by: jeanfabre on January 16, 2015, 02:56:37 AM
Hi,

 Then I think it's a typical issue with bad recognition from windows itself. Could you double check with the author, he will have more experience to pin point if indeed you can't do much about it without forcing the system a bit.

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: sebaslive on April 14, 2015, 11:50:29 AM
Hey Jean, I need some help with the changes in the API. The creator changed it from LeftStickX to LeftStickUp, and now leftStickUp and LeftStickDown get the positive axis from each direction... I need it like a regular GetAxis where it would get the + and the - numbers for it... I would really appreciate this!
Title: Re: InControl Custom Actions
Post by: jeanfabre on April 28, 2015, 04:37:48 AM
Hi,

 It's odd, I just got the latest from inControl rep and it's not like you said. Can you confirm? everything is as normal as far as I can see.

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: aceofclubs on April 30, 2015, 08:55:42 PM
I can confirm the latest from the unity asset store does not contain a definition for leftstick X

it instead has leftstick up and left stick down, Left stick right and left.
Title: Re: InControl Custom Actions
Post by: jeanfabre on May 01, 2015, 01:27:04 AM
Hi,

Ok, I don't own the asset store version, but instead I use the free github repository available on the github author account. I'll get in touch with him to see why there is a difference.

 Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: aceofclubs on May 01, 2015, 09:18:44 PM
Ahh that is the reason,  The github version is no longer being updated. 

"And so, after some deliberation, I'm announcing that the open source version (which roughly corresponds to version 1.4.4) will now be put into a frozen, basic maintenance-only mode. The repository will stay where it is, and I'll continue to try keeping it compatible with Unity 4 and 5, but it will get no new features or significant changes. I hope that it can continue to be helpful in game jams and prototyping, and so I intend to keep it alive as long as is reasonably possible, but it will inevitably begin to age."

http://www.gallantgames.com/posts/30/incontrol-state-of-the-asset


Thanks for your work
Title: Re: InControl Custom Actions
Post by: jeanfabre on May 12, 2015, 04:53:08 AM
Hi,

 ok, I have created a rep for this, and the new package to support this version is on the wiki:

https://hutonggames.fogbugz.com/default.asp?W1183

 Let me know how it goes.

 Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: aceofclubs on May 13, 2015, 12:25:50 PM
Thanks for this,

Added the actions in and it does not bomb the program anymore.  Defiantly a bonus.

I am currently working to try to extend the actions/create new ones so it will also look for the TouchManager class/Devices since the current actions appear to be ignoring touch input controllers.

TouchManager
http://www.gallantgames.com/incontrol-api/html/class_in_control_1_1_touch_manager.html

TouchSwipeControl
http://www.gallantgames.com/incontrol-api/html/class_in_control_1_1_touch_swipe_control.html



AoC
Title: Re: InControl Custom Actions
Post by: aceofclubs on May 13, 2015, 02:47:25 PM
TouchManager Controls:

So far I have been unable to get Playmaker to register the TouchSwipeControl Button Presses with out adding  "inputDevice = InputManager.ActiveDevice;"  to the onUpdate() function

I created a separate action below to handle the Swipe commands, however I am positive it will break if you are trying to use more then 1 controller per device as well.

It does not restrict the "Controller" input.  So for example:  anything that reports D Pad Up was pressed will fire off the code below if your ControlCommand is D Pad Up.


Code: [Select]
using UnityEngine;
using InControl;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("InControl")]
    [Tooltip("Sends an Event when the specified Incontrol control Axis. Optionally store the control state in a bool variable.")]
    public class GetSwipeButtonControls : FsmStateAction
    {

    public InputControlType ControlCommand;

    public FsmEvent sendEvent;
    [UIHint(UIHint.Variable)]
    public FsmBool storeResult;


    bool wasPressed;
    //bool isDownFlag;

    InputDevice inputDevice;

    public override void Reset()
    {
            inputDevice = InputManager.ActiveDevice;
            ControlCommand = InputControlType.DPadUp;
        sendEvent = null;
        storeResult = null;
    }

    public override void OnEnter()
    {
            inputDevice = InputManager.ActiveDevice;
    }

    public override void OnUpdate()
    {
            inputDevice = InputManager.ActiveDevice;
            var temp = inputDevice.GetControl(ControlCommand).WasPressed;
        //wasPressed = _inputDevice.GetControl(axis).WasPressed;

        if (temp)
        {
            Fsm.Event(sendEvent);

        }

        storeResult.Value = temp;
    }
}
}



AoC
Title: Re: InControl Custom Actions
Post by: jeanfabre on May 14, 2015, 02:09:06 AM
Hi,

 You should study examples provided by InControl, I haven't digged into the new features. I have to move on other packages to update them.

 Tell me if you still struggle with this, I'll try to have another look. I am very confused with the new set of controls myself tbh, so contacing the author to get clarifications on use case may be necessary, please do if you are stuck, it may be simple.


Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: aceofclubs on May 14, 2015, 12:45:06 PM
Here is the Action I am using to use the Swipe Control and a Button control, Both set to take up 100% of the screen.  This gives you the ability to handle Swipes and taps on the same screen.  Be sure to adjust your swipe sensitivity to taste to prevent the swipe control from "eating" all the interactions.

One note the action will not limit itself to the touch controls.  Any control that is being used that is firing off the Button Targets you select will trigger this action.  So for example if you hook up a controller and press D Pad Up it will fire off the swipe up control.  You can change this by inspecting the active device to see if it is the touch manager.  I figured if someone is using the touch controls then they likely are not playing with a second person using a gamepad.

Code: [Select]

using UnityEngine;
using InControl;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("InControl")]
    [Tooltip("Requires Button and Swipe Control Sends an Event when the specified Incontrol Button Target.")]

    public class SwipeAndTapControlForIncontrol : FsmStateAction
{
        [Tooltip("Touch Button Control Target")]
    public InputControlType ControlCommandTap;
        [Tooltip("Touch Swipe Control Button Target Up")]
    public InputControlType ControlCommandUp;
        [Tooltip("Touch Swipe Control Button Target Down")]
    public InputControlType ControlCommandDown;
        [Tooltip("Touch Swipe Control Button Target Left")]
    public InputControlType ControlCommandLeft;
        [Tooltip("Touch Swipe Control Button Target Right")]
    public InputControlType ControlCommandRight;
        [Tooltip("Event To Send For Tap")]
    public FsmEvent sendEventTap;
        [Tooltip("Event To Send For Up")]
    public FsmEvent sendEventUp;
        [Tooltip("Event To Send For Down")]
    public FsmEvent sendEventDown;
        [Tooltip("Event To Send For Left")]
    public FsmEvent sendEventLeft;
        [Tooltip("Event To Send For Right")]
    public FsmEvent sendEventRight;





    InputDevice inputDevice;

    public override void Reset()
    {
        inputDevice = InputManager.ActiveDevice;
        ControlCommandTap = InputControlType.Action1;
        ControlCommandUp = InputControlType.DPadUp;
        ControlCommandDown = InputControlType.DPadDown;
        ControlCommandLeft = InputControlType.DPadLeft;
        ControlCommandRight = InputControlType.DPadRight;
        sendEventTap = null;
        sendEventUp = null;
        sendEventDown = null;
        sendEventLeft = null;
        sendEventRight = null;

    }

    public override void OnEnter()
    {
        inputDevice = InputManager.ActiveDevice;
    }

    public override void OnUpdate()
    {
        inputDevice = InputManager.ActiveDevice;
        //var temp = inputDevice.GetControl(ControlCommandTap).WasPressed;
        //wasPressed = _inputDevice.GetControl(axis).WasPressed;
        bool wasSwipeRecieved = false;

       

        if (inputDevice.GetControl(ControlCommandUp).WasPressed)
        {
            wasSwipeRecieved = true;
            Fsm.Event(sendEventUp);
        }
        else if (inputDevice.GetControl(ControlCommandDown).WasPressed)
        {
            wasSwipeRecieved = true;
            Fsm.Event(sendEventDown);
        }
        else if (inputDevice.GetControl(ControlCommandLeft).WasPressed)
        {
            wasSwipeRecieved = true;
            Fsm.Event(sendEventLeft);
        }
        else if (inputDevice.GetControl(ControlCommandRight).WasPressed)
        {
            wasSwipeRecieved = true;
            Fsm.Event(sendEventRight);
        }

        else if (inputDevice.GetControl(ControlCommandTap).WasReleased && wasSwipeRecieved == false)
        {

            Fsm.Event(sendEventTap);
        }
       

    }
}
}


Title: Re: InControl Custom Actions
Post by: jeanfabre on May 20, 2015, 04:04:12 AM
Hi,

 You should either fork the inControl rep or simply use Snipt (https://snipt.net/jeanfabre/) and share your work on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181).

 Let me know if you need some guidance for either.

 Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: 3noneTwo on July 07, 2015, 01:39:50 PM
Hi Jean,

I've been trying to get PlayMaker and InControl to talk all evening, but no matter what I try, the actions refuse to work.

I can get PlayMaker to update variables using the "Get Axis" action using either keyboard or a controller, and PlayMaker responds to mouse actions as well. Likewise, InControl's example projects work correctly with all types of input. But unfortunately, none of the InControl Custom Actions are functioning for me. No button events, no axis updates, nothing.


Right, I feel rather silly. InControl requires the user to add the "InControl Manager" to the scene before anything starts working. This is also true for InControl Custom Actions, they don't function unless the Manager is in the scene. I wasn't seeing any errors, so I assumed everything was set up correctly.

Newbie mistake, sorry about that!
Title: Re: InControl Custom Actions
Post by: jeanfabre on July 08, 2015, 08:05:08 AM
:)

no worries, we all get this!

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: terri on July 08, 2015, 09:24:20 AM
How are you guys setting up the axis?
It seems like it should have a Left Stick X and Left Stick Y option, but it only has Up/Down/Left/Right.
The way I have it set up like the attached image makes the character only move up and to the right. I seem to be missing something obvious?

edit:
I got it to work by changing these 2 lines on the GetInControlDeviceInputAxisVector action (122,123):

Code: [Select]
var h = _inputDevice.GetControl(horizontalAxis).Value;
var v = _inputDevice.GetControl(verticalAxis).Value;
to
Code: [Select]
var h = _inputDevice.LeftStickX.Value;
var v = _inputDevice.LeftStickY.Value;
Title: Re: InControl Custom Actions
Post by: 3noneTwo on July 08, 2015, 12:23:28 PM
How are you guys setting up the axis?
It seems like it should have a Left Stick X and Left Stick Y option, but it only has Up/Down/Left/Right.
I'm running into similar issues with "GetInControlDeviceInputAxis". I can't see any way to test Stick/DPad X/Y axes, only specific directions. Unfortunately I can't use the same workaround.
Title: Re: InControl Custom Actions
Post by: terri on July 08, 2015, 01:40:30 PM
This is super bare bones but here is a Rumble action.

edit: Added better version with Everyframe/Reset on exit

Title: Re: InControl Custom Actions
Post by: 3noneTwo on July 09, 2015, 02:39:06 PM
I've created a temporary extension to 'Get InControl Device Input Axis', along with a set of OneAxisInputControl and TwoAxisInputControl enumerations. These scripts will not overwrite any actions, but they'll make it easier to set up axes!

I'm assuming the enumerations will help make it possible to implement TwoAxisInputControl as part of 'Get InControl Device Input Axis Vector', though I haven't attempted it myself.
Title: Re: InControl Custom Actions
Post by: MABManZ on August 02, 2015, 06:12:57 AM
Hi Jean,

InControl 1.5.0 introduced the ability to rebind actions/buttons at runtime, could Playmaker actions for these be implemented?

http://www.gallantgames.com/pages/incontrol-rebinding-at-runtime
Title: Re: InControl Custom Actions
Post by: jeanfabre on August 03, 2015, 03:32:28 PM
Hi,

 Please bump me mid august, I won't have time before, Siggraph is coming soon :)

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: MABManZ on August 17, 2015, 02:28:39 AM
Bumping! Thanks Jean
Title: Re: InControl Custom Actions
Post by: jeanfabre on August 18, 2015, 04:36:24 PM
Hi,

 I had a look at the doc and description. Unfortunalty, it requires a lot of work on the c# code to get to this point of runtime binding, because of the way it's designed. That is without overriding with your own classes the input management, there is no direct way to have control over binding.

I would contact the Author and see if he would be willing to support Playmaker directly, because this is indeed a major task.

Bye,

 Jean
Title: Re: InControl Custom Actions
Post by: robosaru on November 02, 2015, 10:37:32 PM
Bump from me! Would be great to have a set of working actions for the asset store version on InControl...
Title: Re: InControl Custom Actions
Post by: MajorIdea on May 14, 2016, 11:56:00 AM
Thank you so much 3noneTwo for those actions! They definitely should be included in the InControl package.

Kinda wish I had see that "Warning: InControl Is For Programmers" on the website before buying it as its not in the asset store page.

Maybe I'm missing something but current Playmaker actions seem a bit lacking. I don't even mean the rebinding stuff. I'm having trouble just binding them in the first place. Like setting Action 1 as Space Bar or adapting the stick input (again thanks 3noneTwo!) to WASD.

Are there any plans to better support this? Seems like a lot of unity games are using InControl now.
Title: Re: InControl Custom Actions
Post by: autumnboy on July 18, 2017, 03:04:22 AM
So, Is there anyway to share input/swapping(rebinding) between keyboard and InControls Device Actions?

Is it possible to grab InControl's input as a string to feed into Playmaker's Get Button Down for example?

Or has anyone had any work arounds?

Thanks