diff --git a/anim.js b/anim.js index d886f57..c44d343 100644 --- a/anim.js +++ b/anim.js @@ -264,33 +264,29 @@ window.addEventListener('keyup', (e) => { } }) -var oscCallbacks = { - '/keys': [ - function(args) { - keysPressed = args.map(getVal); - keysPressed[0] |= kbdPressed['a']; - keysPressed[1] |= kbdPressed['s']; - keysPressed[2] |= kbdPressed['d']; - keysPressed[3] |= kbdPressed['f']; - //console.log(keysPressed, kbdPressed); - } - ], - '/quaternion': [ - function (args) { - // Popravimo osi (w x y z po defaultu HMM) - [qWW.w, qWW.z, qWW.x, qWW.y] = args.map(getVal); - } - ], - '/quaternionDiff': [ - function (args) { - [qWWd.w, qWWd.x, qWWd.y, qWWd.z] = args.map(getVal); - } - ], - '/eulerDiff': [ - function (args) { - [dqX, dqY, dqZ] = args.map(getVal); - } - ], +var prepend = '/ww/0'; + +var oscCallbacks = {}; + +oscCallbacks[prepend + '/keys'] = function(args) { + keysPressed = args.map(getVal); + keysPressed[0] |= kbdPressed['a']; + keysPressed[1] |= kbdPressed['s']; + keysPressed[2] |= kbdPressed['d']; + keysPressed[3] |= kbdPressed['f']; + //console.log(keysPressed, kbdPressed); + console.log(args) +}; +oscCallbacks[prepend + '/quaternion'] = function (args) { + // Popravimo osi (w x y z po defaultu HMM) + [qWW.w, qWW.z, qWW.x, qWW.y] = args.map(getVal); +}; +oscCallbacks[prepend + '/quaternionDiff'] = function (args) { + [qWWd.w, qWWd.x, qWWd.y, qWWd.z] = args.map(getVal); +}; +oscCallbacks[prepend + '/eulerDiff'] = function (args) { + [dqX, dqY, dqZ] = args.map(getVal); +} /* Ne uporabljamo vec '/gyro/': [ @@ -327,4 +323,3 @@ var oscCallbacks = { } ], */ -}