{ "patcher": { "fileversion": 1, "appversion": { "major": 9, "minor": 2, "revision": 0, "architecture": "x64", "modernui": 1 }, "classnamespace": "box", "rect": [ 478.0, 193.0, 1000.0, 755.0 ], "integercoordinates": 1, "boxes": [ { "box": { "id": "obj-8", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 358.0, 201.0, 124.0, 20.0 ], "text": "TURN: RIGHT STICK" } }, { "box": { "id": "obj-5", "maxclass": "newobj", "numinlets": 1, "numoutlets": 1, "outlettype": [ "bang" ], "patching_rect": [ 562.0, 171.0, 58.0, 22.0 ], "text": "loadbang" } }, { "box": { "id": "obj-62", "maxclass": "newobj", "numinlets": 8, "numoutlets": 8, "outlettype": [ "", "", "", "", "", "", "", "" ], "patching_rect": [ 518.0, 257.0, 530.0, 22.0 ], "text": "route l_deadzone l_sensitivity trigger_sensitivity invert_triggers r_deadzone r_sensitivity invert_r_y" } }, { "box": { "id": "obj-61", "maxclass": "newobj", "numinlets": 1, "numoutlets": 2, "outlettype": [ "", "" ], "patching_rect": [ 562.0, 201.0, 72.0, 22.0 ], "text": "patcherargs" } }, { "box": { "id": "obj-53", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 440.0, 227.0, 56.0, 20.0 ], "text": "R stick Y" } }, { "box": { "id": "obj-54", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 350.0, 227.0, 56.0, 20.0 ], "text": "R stick X" } }, { "box": { "id": "obj-55", "maxclass": "newobj", "numinlets": 3, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 366.0, 563.0, 123.0, 22.0 ], "text": "join 3" } }, { "box": { "id": "obj-56", "maxclass": "newobj", "numinlets": 2, "numoutlets": 2, "outlettype": [ "float", "float" ], "patcher": { "fileversion": 1, "appversion": { "major": 9, "minor": 2, "revision": 0, "architecture": "x64", "modernui": 1 }, "classnamespace": "dsp.gen", "rect": [ 34.0, 377.0, 1045.0, 450.0 ], "integercoordinates": 1, "boxes": [ { "box": { "id": "obj-19", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 42.0, 190.0, 22.0 ], "text": "param stick_sensitivity 1. @min 0." } }, { "box": { "id": "obj-10", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 70.0, 191.0, 22.0 ], "text": "param invert_x 1 @min 0 @max 1" } }, { "box": { "id": "obj-9", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 97.0, 191.0, 22.0 ], "text": "param invert_y 0 @min 0 @max 1" } }, { "box": { "id": "obj-5", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 14.0, 218.0, 22.0 ], "text": "param dead_zone 0. @min 0. @max 1." } }, { "box": { "id": "obj-13", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 570.0, 15.0, 19.0, 20.0 ], "text": "Y" } }, { "box": { "id": "obj-12", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 85.0, 15.0, 19.0, 20.0 ], "text": "X" } }, { "box": { "id": "obj-7", "maxclass": "newobj", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 535.0, 416.0, 35.0, 22.0 ], "text": "out 1" } }, { "box": { "code": "// Scaled radial deadzone\r\n// Src: https://github.com/Minimuino/thumbstick-deadzones\r\nx = in1;\r\ny = in2; \r\n\r\nmag = sqrt(x*x + y*y);\r\nout_x = 0;\r\nout_y = 0;\r\n\r\nif (mag >= dead_zone) {\r\n scaled_mag = (mag - dead_zone) / (1 - dead_zone);\r\n out_x = x * scaled_mag / mag;\r\n out_y = y * scaled_mag / mag;\r\n}\r\n\r\nout_x = int(invert_x) == 1 ? -1 * out_x : out_x;\r\nout_y = int(invert_y) == 1 ? -1 * out_y : out_y;\r\n\r\nout_x = clip(out_x, -1, 1);\r\nout_y = clip(out_y, -1, 1);\r\n\r\nout_x *= stick_sensitivity;\r\nout_y *= stick_sensitivity;\r\n\r\nout1 = out_x;\r\nout2 = out_y;", "fontface": 0, "fontname": "", "fontsize": 12.0, "id": "obj-6", "maxclass": "codebox", "numinlets": 2, "numoutlets": 2, "outlettype": [ "", "" ], "patching_rect": [ 50.0, 70.0, 504.0, 329.0 ] } }, { "box": { "id": "obj-1", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 50.0, 14.0, 28.0, 22.0 ], "text": "in 1" } }, { "box": { "id": "obj-2", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 535.0, 14.0, 28.0, 22.0 ], "text": "in 2" } }, { "box": { "id": "obj-4", "maxclass": "newobj", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 50.0, 416.0, 35.0, 22.0 ], "text": "out 2" } } ], "lines": [ { "patchline": { "destination": [ "obj-6", 0 ], "source": [ "obj-1", 0 ] } }, { "patchline": { "destination": [ "obj-6", 1 ], "source": [ "obj-2", 0 ] } }, { "patchline": { "destination": [ "obj-4", 0 ], "source": [ "obj-6", 0 ] } }, { "patchline": { "destination": [ "obj-7", 0 ], "source": [ "obj-6", 1 ] } } ] }, "patching_rect": [ 366.0, 521.0, 71.0, 22.0 ], "text": "gen @t turn" } }, { "box": { "id": "obj-57", "maxclass": "newobj", "numinlets": 2, "numoutlets": 2, "outlettype": [ "", "" ], "patching_rect": [ 366.0, 625.0, 60.0, 22.0 ], "text": "zl.change" } }, { "box": { "id": "obj-58", "maxclass": "newobj", "numinlets": 2, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 366.0, 257.0, 107.0, 22.0 ], "text": "join 2 @triggers -1" } }, { "box": { "attr": "dead_zone", "id": "obj-59", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 411.0, 415.0, 150.0, 22.0 ] } }, { "box": { "attr": "stick_sensitivity", "id": "obj-60", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 429.0, 447.0, 150.0, 22.0 ] } }, { "box": { "comment": "Passes messages from gamepad that haven't been used", "id": "obj-9", "index": 2, "maxclass": "outlet", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 1029.0, 444.0, 30.0, 30.0 ] } }, { "box": { "id": "obj-6", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 801.0, 325.0, 128.0, 20.0 ], "text": "RIGHT STICK - TURN" } }, { "box": { "id": "obj-4", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 87.0, 201.0, 198.0, 20.0 ], "text": "MOVE: LEFT STICK + TRIGGERS " } }, { "box": { "comment": "move and turn messages to use with jit.anim.node", "id": "obj-2", "index": 1, "maxclass": "outlet", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 62.0, 736.0, 30.0, 30.0 ] } }, { "box": { "id": "obj-1", "maxclass": "newobj", "numinlets": 7, "numoutlets": 7, "outlettype": [ "", "", "", "", "", "", "" ], "patching_rect": [ 62.0, 135.0, 475.0, 22.0 ], "text": "route axis_left_x axis_left_y axis_left_trigger axis_right_trigger axis_right_x axis_right_y" } }, { "box": { "id": "obj-118", "maxclass": "newobj", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 62.0, 668.0, 85.0, 22.0 ], "text": "prepend move" } }, { "box": { "id": "obj-75", "maxclass": "newobj", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 366.0, 668.0, 77.0, 22.0 ], "text": "prepend turn" } }, { "box": { "comment": "Connect to gamepad object", "id": "obj-113", "index": 1, "maxclass": "inlet", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 62.0, 57.0, 30.0, 30.0 ] } }, { "box": { "id": "obj-35", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 272.0, 232.0, 55.0, 20.0 ], "text": "R trigger" } }, { "box": { "id": "obj-34", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 195.0, 232.0, 52.0, 20.0 ], "text": "L trigger" } }, { "box": { "id": "obj-31", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 124.0, 232.0, 53.0, 20.0 ], "text": "L stick Y" } }, { "box": { "id": "obj-30", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 62.0, 232.0, 53.0, 20.0 ], "text": "L stick X" } }, { "box": { "id": "obj-19", "maxclass": "newobj", "numinlets": 3, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 62.0, 563.0, 86.0, 22.0 ], "text": "join 3" } }, { "box": { "id": "obj-25", "maxclass": "newobj", "numinlets": 4, "numoutlets": 3, "outlettype": [ "float", "float", "float" ], "patcher": { "fileversion": 1, "appversion": { "major": 9, "minor": 2, "revision": 0, "architecture": "x64", "modernui": 1 }, "classnamespace": "dsp.gen", "rect": [ 34.0, 377.0, 1045.0, 450.0 ], "integercoordinates": 1, "boxes": [ { "box": { "id": "obj-3", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 136.0, 225.0, 22.0 ], "text": "param invert_triggers 0 @min 0 @max 1" } }, { "box": { "id": "obj-22", "maxclass": "newobj", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 599.0, 416.0, 35.0, 22.0 ], "text": "out 2" } }, { "box": { "code": "l_trig = in1;\r\nr_trig = in2;\r\nelev = l_trig > r_trig ? -1 * l_trig : r_trig;\r\nelev *= trigger_sensitivity;\r\nelev = int(invert_triggers) ? -1 * elev : elev;\r\nout1 = elev;", "fontface": 0, "fontname": "", "fontsize": 12.0, "id": "obj-21", "maxclass": "codebox", "numinlets": 2, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 599.0, 256.0, 374.0, 143.0 ] } }, { "box": { "id": "obj-20", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 161.0, 197.0, 22.0 ], "text": "param trigger_sensitivity 1. @min 0" } }, { "box": { "id": "obj-19", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 42.0, 190.0, 22.0 ], "text": "param stick_sensitivity 1. @min 0." } }, { "box": { "id": "obj-18", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 989.0, 217.0, 55.0, 20.0 ], "text": "R trigger" } }, { "box": { "id": "obj-17", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 633.0, 217.0, 52.0, 20.0 ], "text": "L trigger" } }, { "box": { "id": "obj-15", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 954.0, 216.0, 28.0, 22.0 ], "text": "in 4" } }, { "box": { "id": "obj-14", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 599.0, 216.0, 28.0, 22.0 ], "text": "in 3" } }, { "box": { "id": "obj-13", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 570.0, 15.0, 53.0, 20.0 ], "text": "L stick Y" } }, { "box": { "id": "obj-12", "maxclass": "comment", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 85.0, 15.0, 53.0, 20.0 ], "text": "L stick X" } }, { "box": { "id": "obj-10", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 70.0, 191.0, 22.0 ], "text": "param invert_x 0 @min 0 @max 1" } }, { "box": { "id": "obj-9", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 97.0, 191.0, 22.0 ], "text": "param invert_y 1 @min 0 @max 1" } }, { "box": { "id": "obj-7", "maxclass": "newobj", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 535.0, 416.0, 35.0, 22.0 ], "text": "out 3" } }, { "box": { "code": "// Scaled radial deadzone\r\n// Src: https://github.com/Minimuino/thumbstick-deadzones\r\nx = in1;\r\ny = in2; \r\n\r\nmag = sqrt(x*x + y*y);\r\nout_x = 0;\r\nout_y = 0;\r\n\r\nif (mag >= dead_zone) {\r\n scaled_mag = (mag - dead_zone) / (1 - dead_zone);\r\n out_x = x * scaled_mag / mag;\r\n out_y = y * scaled_mag / mag;\r\n}\r\n\r\nout_x = int(invert_x) == 1 ? -1 * out_x : out_x;\r\nout_y = int(invert_y) == 1 ? -1 * out_y : out_y;\r\n\r\nout_x = clip(out_x, -1, 1);\r\nout_y = clip(out_y, -1, 1);\r\n\r\nout_x *= stick_sensitivity;\r\nout_y *= stick_sensitivity;\r\n\r\nout1 = out_x;\r\nout2 = out_y;", "fontface": 0, "fontname": "", "fontsize": 12.0, "id": "obj-6", "maxclass": "codebox", "numinlets": 2, "numoutlets": 2, "outlettype": [ "", "" ], "patching_rect": [ 50.0, 70.0, 504.0, 329.0 ] } }, { "box": { "id": "obj-5", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 659.0, 14.0, 218.0, 22.0 ], "text": "param dead_zone 0. @min 0. @max 1." } }, { "box": { "id": "obj-1", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 50.0, 14.0, 28.0, 22.0 ], "text": "in 1" } }, { "box": { "id": "obj-2", "maxclass": "newobj", "numinlets": 0, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 535.0, 14.0, 28.0, 22.0 ], "text": "in 2" } }, { "box": { "id": "obj-4", "maxclass": "newobj", "numinlets": 1, "numoutlets": 0, "patching_rect": [ 50.0, 416.0, 35.0, 22.0 ], "text": "out 1" } } ], "lines": [ { "patchline": { "destination": [ "obj-6", 0 ], "source": [ "obj-1", 0 ] } }, { "patchline": { "destination": [ "obj-21", 0 ], "source": [ "obj-14", 0 ] } }, { "patchline": { "destination": [ "obj-21", 1 ], "source": [ "obj-15", 0 ] } }, { "patchline": { "destination": [ "obj-6", 1 ], "source": [ "obj-2", 0 ] } }, { "patchline": { "destination": [ "obj-22", 0 ], "source": [ "obj-21", 0 ] } }, { "patchline": { "destination": [ "obj-4", 0 ], "source": [ "obj-6", 0 ] } }, { "patchline": { "destination": [ "obj-7", 0 ], "source": [ "obj-6", 1 ] } } ] }, "patching_rect": [ 62.0, 521.0, 86.0, 22.0 ], "text": "gen @t move" } }, { "box": { "id": "obj-3", "maxclass": "newobj", "numinlets": 2, "numoutlets": 2, "outlettype": [ "", "" ], "patching_rect": [ 62.0, 625.0, 60.0, 22.0 ], "text": "zl.change" } }, { "box": { "id": "obj-292", "maxclass": "newobj", "numinlets": 4, "numoutlets": 1, "outlettype": [ "" ], "patching_rect": [ 62.0, 257.0, 247.0, 22.0 ], "text": "join 4 @triggers -1" } }, { "box": { "attr": "dead_zone", "id": "obj-15", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 93.0, 369.0, 150.0, 22.0 ] } }, { "box": { "attr": "stick_sensitivity", "id": "obj-32", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 131.0, 427.0, 150.0, 22.0 ] } }, { "box": { "attr": "trigger_sensitivity", "id": "obj-33", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 111.0, 398.0, 150.0, 22.0 ] } }, { "box": { "attr": "invert_y", "id": "obj-65", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 440.0, 476.0, 150.0, 22.0 ] } }, { "box": { "attr": "invert_triggers", "id": "obj-66", "maxclass": "attrui", "numinlets": 1, "numoutlets": 1, "outlettype": [ "" ], "parameter_enable": 0, "patching_rect": [ 142.0, 455.0, 150.0, 22.0 ] } } ], "lines": [ { "patchline": { "destination": [ "obj-292", 3 ], "source": [ "obj-1", 3 ] } }, { "patchline": { "destination": [ "obj-292", 2 ], "source": [ "obj-1", 2 ] } }, { "patchline": { "destination": [ "obj-292", 1 ], "source": [ "obj-1", 1 ] } }, { "patchline": { "destination": [ "obj-292", 0 ], "source": [ "obj-1", 0 ] } }, { "patchline": { "destination": [ "obj-58", 1 ], "source": [ "obj-1", 5 ] } }, { "patchline": { "destination": [ "obj-58", 0 ], "source": [ "obj-1", 4 ] } }, { "patchline": { "destination": [ "obj-62", 0 ], "source": [ "obj-1", 6 ] } }, { "patchline": { "destination": [ "obj-1", 0 ], "source": [ "obj-113", 0 ] } }, { "patchline": { "destination": [ "obj-2", 0 ], "source": [ "obj-118", 0 ] } }, { "patchline": { "destination": [ "obj-25", 0 ], "source": [ "obj-15", 0 ] } }, { "patchline": { "destination": [ "obj-3", 0 ], "source": [ "obj-19", 0 ] } }, { "patchline": { "destination": [ "obj-19", 2 ], "source": [ "obj-25", 2 ] } }, { "patchline": { "destination": [ "obj-19", 1 ], "source": [ "obj-25", 1 ] } }, { "patchline": { "destination": [ "obj-19", 0 ], "source": [ "obj-25", 0 ] } }, { "patchline": { "destination": [ "obj-25", 0 ], "source": [ "obj-292", 0 ] } }, { "patchline": { "destination": [ "obj-118", 0 ], "source": [ "obj-3", 0 ] } }, { "patchline": { "destination": [ "obj-25", 0 ], "source": [ "obj-32", 0 ] } }, { "patchline": { "destination": [ "obj-25", 0 ], "source": [ "obj-33", 0 ] } }, { "patchline": { "destination": [ "obj-61", 0 ], "source": [ "obj-5", 0 ] } }, { "patchline": { "destination": [ "obj-57", 0 ], "source": [ "obj-55", 0 ] } }, { "patchline": { "destination": [ "obj-55", 1 ], "source": [ "obj-56", 1 ] } }, { "patchline": { "destination": [ "obj-55", 0 ], "source": [ "obj-56", 0 ] } }, { "patchline": { "destination": [ "obj-75", 0 ], "source": [ "obj-57", 0 ] } }, { "patchline": { "destination": [ "obj-56", 0 ], "source": [ "obj-58", 0 ] } }, { "patchline": { "destination": [ "obj-56", 0 ], "source": [ "obj-59", 0 ] } }, { "patchline": { "destination": [ "obj-56", 0 ], "source": [ "obj-60", 0 ] } }, { "patchline": { "destination": [ "obj-62", 0 ], "source": [ "obj-61", 1 ] } }, { "patchline": { "destination": [ "obj-15", 0 ], "source": [ "obj-62", 0 ] } }, { "patchline": { "destination": [ "obj-32", 0 ], "source": [ "obj-62", 1 ] } }, { "patchline": { "destination": [ "obj-33", 0 ], "source": [ "obj-62", 2 ] } }, { "patchline": { "destination": [ "obj-59", 0 ], "source": [ "obj-62", 4 ] } }, { "patchline": { "destination": [ "obj-60", 0 ], "source": [ "obj-62", 5 ] } }, { "patchline": { "destination": [ "obj-65", 0 ], "source": [ "obj-62", 6 ] } }, { "patchline": { "destination": [ "obj-66", 0 ], "source": [ "obj-62", 3 ] } }, { "patchline": { "destination": [ "obj-9", 0 ], "source": [ "obj-62", 7 ] } }, { "patchline": { "destination": [ "obj-56", 0 ], "source": [ "obj-65", 0 ] } }, { "patchline": { "destination": [ "obj-25", 0 ], "source": [ "obj-66", 0 ] } }, { "patchline": { "destination": [ "obj-2", 0 ], "source": [ "obj-75", 0 ] } } ] } }