|
Hey there, this problem sounds pretty easy to solve, but.... I don't get it. I want to have a kind of loop that counts up the variable "acceleration" WHILE the space bar is pressed.And them when it is not pressed anymore I want to add a relative Force to the ball. rigidbody.AddRelativeForce (Vector3.forward * acceleration); So how do I write a counter, which counts while a button is pressed, and then, when it isn't anymore, it does whatever I want? (For Example the Pinball game of windows) It tried a while loop, which crashed my game several times...
(comments are locked)
|
Simple, adds to the power variable when the Jump button is down. When it is released we add force to the rigidbody. Let me know if there are any errors :)
(comments are locked)
|
|
no errors, worked well :) , thx a lot Please post as comments in the comments bit, not as answers.
Apr 29 '11 at 11:28 PM
Fishman92
(comments are locked)
|
|
oh well there is small error there is: power += forceToAdd * Time.deltaTine; should be: power += forceToAdd * Time.deltaTime; Time not Tine.
(comments are locked)
|
