Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

It would be better to provide more details.

  • I assume you are making a 2D game, so first of all it should be Rigidbody2D not Rigidbody.
  • I understand the use of if (transform.position.y < initialPosition.y) but the player simply has no time to react at all before it tp back to initial position. You might want to do something like if (transform.position.y < initialPosition.y - 5)
  • I have no idea why do you want to simulate gravity when there's built in gravity for Rigidbody2D or Rigidbody already. And your way to apply gravity is in linear, not in exponential. If you want to know more about gravity check it on Internet.
  • rb.velocity according to my understanding is an acceleration, not a thrust boost. There's ForceMode.Impluse.

Not trying to be mean or whatsoever, but I think you should follow a step to step guide online.

Anyway gl on your entry