I want to collect accelerometer force while a button is held down and when it is released a apply that to a rigid body. How do I make it so it does that?
function OnGUI () {
if (GUI.RepeatButton (Rect (10,10,150,50), "Apply Upward Force")) {
time += Time.deltaTime;
total += iPhoneInput.acceleration.y;
}
then i want to do something like myRigidBody.AddForce (Vector3.up * total);
I don't want the myRigidBody.AddForce to execute until after the data ids collected though.