Code:
If(VSize(AverageVelocity)>=GestureVelocityThreshold) { DotUR=((Normal(AverageVelocity)) DOT (Normal(Vect(0,1,1)))); DotUC=((Normal(AverageVelocity)) DOT (Normal(Vect(0,0,1)))); DotUL=((Normal(AverageVelocity)) DOT (Normal(Vect(0,-1,1)))); DotCR=((Normal(AverageVelocity)) DOT (Normal(Vect(0,1,0)))); DotCL=((Normal(AverageVelocity)) DOT (Normal(Vect(0,-1,0)))); DotDR=((Normal(AverageVelocity)) DOT (Normal(Vect(0,1,-1)))); DotDC=((Normal(AverageVelocity)) DOT (Normal(Vect(0,0,-1)))); DotDL=((Normal(AverageVelocity)) DOT (Normal(Vect(0,-1,-1)))); DotFor=((Normal(AverageVelocity)) DOT (Normal(Vect(1,0,0)))); DotBack=((Normal(AverageVelocity)) DOT (Normal(Vect(-1,0,0)))); DotNum=0.000; If(DotUR>DotNum) { VelocityGesture=9; DotNum=DotUR; } Else If(DotUC>DotNum) { VelocityGesture=8; DotNum=DotUC; } Else If(DotUL>DotNum) { VelocityGesture=7; DotNum=DotUL; } Else If(DotCR>DotNum) { VelocityGesture=6; DotNum=DotCR; } Else If(DotFor>DotNum) { VelocityGesture=5; DotNum=DotCC; } Else If(DotCL>DotNum) { VelocityGesture=4; DotNum=DotCL; } Else If(DotDR>DotNum) { VelocityGesture=3; DotNum=DotDR; } Else If(DotDC>DotNum) { VelocityGesture=2; DotNum=DotDC; } Else If(DotDL>DotNum) { VelocityGesture=1; DotNum=DotDL; } Else If(DotBack>DotNum) { VelocityGesture=-5; DotNum=DotBack; } } Else { VelocityGesture=0; }
EDIT:
Maybe like I should have been using ifs instead of else ifs.... :/ Also, dotnum should start less than -1. Silly me