I am trying to make a choppping motion based on the accelerometer of my tablet and showing it using away3D box. Essentially what I want to do it every time the user shakes the device on accelerationY the box moves up and then right away moves back down. Think of a knife chopping motion. Right now I have the following code but it seems to cancel itself out and just remain in the same place. Any help would be much appreciated!
protected function onAccUpdate(event:AccelerometerEvent):void{
var threshold:Number = 1.5;
if(event.accelerationY > threshold){
targetY = event.accelerationY *10;
knife.y += targetY;
trace(knife.y);
if (knife.y >0){
knife.y -= targetY;
trace(knife.y);
}