28 March 2021

Vecter Controller: Progress Review

 My controller for Vecter turns the player’s hand into the hovercraft. You can gesture the various movement options with your hand to directly control the vehicle. I’ve primarily utilized the CPE’s accelerometer to detect the x and y axis of your hand and mapped various tilting gestures to the correlating vehicle inputs. Tilting left or right make the vehicle strafe left or right. In Vecter, rarely do you want to stop accelerating, so I’ve decided to make it toggle upon tilting forward for the first time, which only toggles off when tilting back to brake. Tilting forward while already accelerating will activate a boost. This allows you to keep your hand in a more comfortable position while still playing the game optimally.

While the player can shoot endlessly, it will subtract from your score so I want its input to be very clear. My idea is to attach a contact to the fingers and the palm, so that making a fist fires your weapon. Or alternatively, just the index finger and thumb.


That where my first question comes in. Is a contact switch too simple? Shooting is the only input that I feel shouldn’t be on the accelerometer, but I struggled to come up with an alternative that I was satisfied with.


Secondly, could this design benefit from moving the shooting(or other) input to another hand? After testing my code, I feel comfortable having all the input be on one hand. However, once I get to designing a custom, 3D-printed, housing I fear weight will become an issue.








The code below is partially functional (uses CPE only) as I really wanted to test my ideas before committing to one. Feel free to test it yourself (Serial Monitor must be open): 


/* * Custom Controller Pseudo Code * Gyro Band - Cameron Friday */ #include <Keyboard.h> #include <Adafruit_CircuitPlayground.h> #include <Adafruit_Circuit_Playground.h> //shooting control pin //boolean for shooting/set void setup() { // put your setup code here, to run once: //Initialize CPE and Keyboard output Serial.begin(9600); while(!Serial); CircuitPlayground.begin(); Keyboard.begin(); //read shooting pin //set shooting bool according to switch's starting state } void loop() { // put your main code here, to run repeatedly: //read accelerometer x and y float x = CircuitPlayground.motionX(); float y = CircuitPlayground.motionY(); Serial.print(x); Serial.print("\t"); Serial.println(y); //read shooting pin //set shooting bool accordinlgy ////GYRO CONTROLS BELOW//// //Strafe Right// if(x <= -4) { Keyboard.press('d'); //light up right side Neopixels } //Strafe Left// if(x >= 4) { Keyboard.press('a'); //light up left side Neopixels } //Brake if tilting backwards// if (y >= 4) { Keyboard.press('s'); //toggle off acceleration Keyboard.release('w'); } //toggle off acceleration //light up rear Neopixels, red //Boost ONCE if tilting forward// if (y <= -4) { //toggle on acceleration Keyboard.press('w'); //Boost Neopixel animation, only if it doesn't interrupt other processes } //Neutral X Axis// if ((x > -4) && (x < 4)) { Keyboard.release('d'); Keyboard.release('a'); //all Neopixels dimly lit } //Neutral Y Axis// if ((y > -4) && (y < 4)) { Keyboard.release('s'); } }

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.