{"action":"created","issue":{"url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/179","repository_url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin","labels_url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/179/comments","events_url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/179/events","html_url":"https://github.com/ValveSoftware/steamvr_unity_plugin/issues/179","id":374807973,"node_id":"MDU6SXNzdWUzNzQ4MDc5NzM=","number":179,"title":"Need system to find conflicting actions","user":{"login":"AndersMalmgren","id":817577,"node_id":"MDQ6VXNlcjgxNzU3Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/817577?v=4","gravatar_id":"","url":"https://api.github.com/users/AndersMalmgren","html_url":"https://github.com/AndersMalmgren","followers_url":"https://api.github.com/users/AndersMalmgren/followers","following_url":"https://api.github.com/users/AndersMalmgren/following{/other_user}","gists_url":"https://api.github.com/users/AndersMalmgren/gists{/gist_id}","starred_url":"https://api.github.com/users/AndersMalmgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndersMalmgren/subscriptions","organizations_url":"https://api.github.com/users/AndersMalmgren/orgs","repos_url":"https://api.github.com/users/AndersMalmgren/repos","events_url":"https://api.github.com/users/AndersMalmgren/events{/privacy}","received_events_url":"https://api.github.com/users/AndersMalmgren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-28T22:44:36Z","updated_at":"2018-10-30T09:10:57Z","closed_at":null,"author_association":"NONE","body":"This is a fork from #165 \r\n\r\nPasted from that issue:\r\n\r\nI think somehow flagging a action set as more important than another and if any buttons inside the less important action set conflicts then disable the conflicted actions in the less important group would be the most elegant way togo. Maybe also a method for testing two actions if they conflict could be nice, though it might be redundant if we can use the actions sets like described above.\r\n\r\nEdit: it would also be really elegant if the conflict code was very smart. For example using D Pad north would not conflict with a action using D pad east, but a action using touchpad touch or click would. Also using the vector2 output from the touchpad also conflicts with any d pad bound action. I understand this would be some work, but it would be really elegant and alot of games with touchpad movement and snap turn would gain from this, basicly any shooter like our own."},"comment":{"url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/comments/434224178","html_url":"https://github.com/ValveSoftware/steamvr_unity_plugin/issues/179#issuecomment-434224178","issue_url":"https://api.github.com/repos/ValveSoftware/steamvr_unity_plugin/issues/179","id":434224178,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDIyNDE3OA==","user":{"login":"AndersMalmgren","id":817577,"node_id":"MDQ6VXNlcjgxNzU3Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/817577?v=4","gravatar_id":"","url":"https://api.github.com/users/AndersMalmgren","html_url":"https://github.com/AndersMalmgren","followers_url":"https://api.github.com/users/AndersMalmgren/followers","following_url":"https://api.github.com/users/AndersMalmgren/following{/other_user}","gists_url":"https://api.github.com/users/AndersMalmgren/gists{/gist_id}","starred_url":"https://api.github.com/users/AndersMalmgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndersMalmgren/subscriptions","organizations_url":"https://api.github.com/users/AndersMalmgren/orgs","repos_url":"https://api.github.com/users/AndersMalmgren/repos","events_url":"https://api.github.com/users/AndersMalmgren/events{/privacy}","received_events_url":"https://api.github.com/users/AndersMalmgren/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T09:10:57Z","updated_at":"2018-10-30T09:10:57Z","author_association":"NONE","body":"I wrote this just to have something until this is supported natively. Downside is it will detect conflict between **D Pad North** and **D Pad South** for example all though there is no conflict.  Also I cache the output because `GetDeviceComponentName` uses some string handling etc. We would need a feature in SteamVR input that let us subscribe to when bindings change so we can update caches like these. Also it would be nifty if we can bring up the Bindings UI from within the game for better user experience from our settings menu in game.\r\n\r\n```csharp\r\n    public static class ActionExtensions \r\n    {\r\n        //TODO: reset this when bindings update Issue #179\r\n        private static readonly Dictionary<SteamVR_Action_In, Dictionary<SteamVR_ActionSet, bool>> conflicts = new Dictionary<SteamVR_Action_In, Dictionary<SteamVR_ActionSet, bool>>();\r\n\r\n\r\n        public static bool Conflicts(this SteamVR_Action_In action, SteamVR_ActionSet set, SteamVR_Input_Sources source)\r\n        {\r\n            if(!conflicts.ContainsKey(action)) conflicts[action]  = new Dictionary<SteamVR_ActionSet, bool>();\r\n            var c = conflicts[action];\r\n            if (!c.ContainsKey(set))\r\n            {\r\n                c[set] = false;\r\n\r\n                foreach (var suspect in set.nonVisualInActions)\r\n                {\r\n                    if (suspect.GetDeviceComponentName(source) == action.GetDeviceComponentName(source))\r\n                    {\r\n                        c[set] = true;\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n\r\n            return c[set];\r\n        }\r\n    }\r\n```"}}
{"actor":{"display_login":"AndersMalmgren"}}