fail to achieve bounce using return, update not running function
fail to achieve bounce using return, update not running function

4 Replies

You might ask in #game-dev since it's Unity. I'm not quite sure what you're asking.
1) Attach a
Rigidbody
instead, and use AddForce
; docs,
2) Consequently, you should use FixedUpdate
, and not Update
here
3) Your current setup only executes the two functions once as the second time it is executed, for example x
, -0.09f
(reversed from the first run) + -3.01f
equals -3.19f
, hitting your return statement.thanks for your suggestions. I am still learning.