I am a newbie on coding, wanted to work on a game as practice and started to work on a 2D top view game, and on a barren desert area, I have a Twigball for my player to touch and move it because of its dynamic rigidbody.
This Twigball has 2 animations which those are idle and movement animations. Everytime my player touches, Twigball moves, changes its position. But what I need is: Everytime this Twigball moves by touching or any other ways, I want its "isMoving" bool is "true" and make it start the "movement" animation, everytime it stops, I want to start its "idle" animation.
It might be simple thing but I couldn't find how to do it with code. Rigidbody works good with its options (linear drag, angular drag etc...) on inspector. I have a TwigBallBehaviour
script attached to the TwigBall but its empty. OnColliderEnter would work for Player touches etc. but this Twigball will also move itself as behaviour. So I need codes to do all that I think, probably calculating position etc... I have already done all changes in Animator window. But what should I write as code? Any advices?