Reduce Gravity During Play

Hi everyone! Complete noob here, started at the beginning of Feb. Trying to make a 2d platformer at the moment. My sprite is using the platformer controller script. So here is my question:
How do I change some of the var’s, gravity, fall speed, ect. with a button during game play? I would like to be hopping around then switch to an ability that allows the character to trigger an animation and float in the air for a short period of time. Or perhaps the button simply turns gravity off and the initial velocity carries the character in whatever direction… Thanks!

1 Answer

1

Physics.gravity is what you’re looking for to change Gravity.

You can adjust the drag on your character Rigid Body with Rigidbody.Drag