Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit) (+2)

before I swapped over to a kinematic character controller i worked on a custom character controller for about 8 months.. Slopes also worked me over real good.. In the end the best solution I found was also probably the most straightforward..

    private void ApplyGravity() // before Move()
    {       
         if (myCC.isGrounded && generatedGravity < playerSettings.desiredGravity)
         {
         generatedGravity = playerSettings.desiredGravity;
         }
         generatedGravity += playerSettings.desiredGravity * Time.deltaTime;
    }

Can't say It'd be even useful for you but I figured why not offer..
I constantly apply my own gravity ( generatedGravity ) at all times. And before that if the player is grounded I set it to a constant value..

This seemed to work out well for me after playing with the values to get something that glided down and up the ramps smoothly.

Then of course, this doesn't affect my jumping as I cancel out my Y velocity before I do..

Funny enough, I'm also using a kinematic rigidbody character controller, with raycast based collision detection and psuedo-physics