I’m making a 2D game for smartphones and I have an object which I want to add horizontal gravity to.
Basically I have a character and I want it to have gravity-like effect (moving slowly and picking up speed - you could say like Flappy Bird), but horizontally - left/right.
My first question is what is the most appropriate way to do it?
I’d also like to make a script which would change the direction of “gravity” when you click or tap on the screen.
So a character moving left or right in gravity-like effect and changing direction of moving by tapping onto screen.
But if you have rigidbody not only on character and need to change gravity only for character then this is not best solution, then you need custom gravity emulation in script for example like this (remember to set gravity scale on character’s rigidbody component to zero):