Change the gravity direction for CharacterController

like what the title says … i have a CharacterController … i made a code to change the rotation of the player so he would look like walking on the roof … but he’s walking on the floor upside down … how can i change the gravity ?

If you have a CharacterController and you want to change the gravity, you have to access the component’s CharacterMotor.movement.gravity variable and change it. By default the CharacterController will only work with positive and negative gravity, you will have to build something different if you want to have complete control over gravity direction rather than simply switching its direction along the y axis.

I built my gravity inverted, I had to make sure to set CharacterMotor.grounded = false in order for the character not to be stuck on the roof.

I know your question is over two years old, but in case someone has a similar one someday, they might find this answer helpful.