Custom Character Controller Slope Sliding

Hi. I’m creating a custom character controller that uses its own collider. It is controller using VectorForces. I’m trying to prevent the character from sliding down slopes when their standing still.

  1. What do you want to achieve?
    I’m trying to prevent the characters collider (which is shaped like a sphere) from sliding down sloped surfaces. I’m trying to achieve something similar to this;

  2. What is the issue?
    The issue is that I can’t figure out how to make the character stop sliding.

  3. What solutions have you tried so far?
    I have tried adding gravity to the Character collider’s VectorForce Force, but when the collider walks back down the slope, it just leaves it floating. I’ve also tried looking through the code of Robot 64 to see how it was done, but I couldn’t understand how it worked.

This is the uncopylocked engine for Robot 64 if your going to look at the code: ​​Robot 64 Engine

I’ll give more details if needed.

When the player is standing (and his velocity isn’t high) make a part under the player’s character and make it invisible so player will stand on that platform

I’ve tried do this, but the character just started levitating

Create a raycast from the player pointing downward, and then set VectorForce to the inverted normal you get from the raycast result

1 Like

Thx! It didn’t work at first, but I just had to set it to the negative normal * the gravity * the characters mass. It works but now the facing direction for the collider faces in weird directions. It uses and align orientation and looks at the VectorForces Force. Here is the code:

collider.AlignOrientation.CFrame = CFrame.lookAlong(collider.Position,collider.VectorForce.Force*Vector3.new(1,0,1))).Rotation

Never mind. I just have to change some settings of the AlignOrientation. Everything works now! :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.