keijiro / Minis

Minis: MIDI Input for New Input System -- A plugin that adds MIDI input support to Unity's new Input System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing control values / infinite twisting

dobertson opened this issue · comments

I've got a wee problem with a specific implementation.

I'm trying to use one of the knobs to change the forward direction of a character in unity. The idea being that you twist the knob, and the character will rotate in that direction. I was thinking I would do a little bit of logic where if the new value is greater than the previous, turn one direction, or if the new value is less than the previous, turn the other direction.

midiDevice.onWillControlChange += RotateCharacter;

However I have an issue where, let's say, I keep twisting right (I don't know how other midi controllers work, but I can infinitely twist the knobs in any direction on mine) the control value will reach 1 and will be stuck at that value. If the player twists to that point, and wants to keep twisting to further spin the character they won't be able to, RotateCharacter is not run when the min/max value is reached.

Is there some other way I can get the direction the knob is twisting? One idea I had would be to reset the knobs value to something like 0.5, but is it possible to do that?

Cheers

You have to use a rotary encoder device that supports relative control mode. For example: http://support.nektartech.com/s.nl/ctype.KB/it.I/id.750/KB.1129/.f

If your device only supports absolute mode, I think it's impossible to support infinite twisting.

That's exactly what I need, I'm using a Minilab mkii and I'm able to change the control option to relative using Arturia's Midi Control Centre software.

Cheers mate, you're a star!