Hey all, I’m not really sure if this should be here in Scripting or in Physics, and I’ll explain later.
I’m using a character controller script by Renaissance Coders on YouTube, but I have an issue where if the character is on a slope, they slide down. If needed, I’ll post my script when I get home.
If I set the rigidbody on the character to not use gravity, and instead force the player down to the ground via script, then they no long slide down slopes. However, they now move much faster going down hill and much slower going up hill, compared to level terrain.
Neither of these is really acceptable, and I’m not sure if the fix is in the Physics side, or if it’s something I’ll need to program in via scripting, or a combination of both. Any help would be appreciated.
Just to note, my character is currently a simple sphere with the character controller and rigid body components.
That sounds like the script is code to react with the rigid body physics, I wouldn’t be to fimilear with this format but try debug the code to find physics involved, and if not it could just be the rigid odd itself. Disabling use gravity will cause the player to glide away but you can try ground him via script.
The character controller that comes with the standard unity assets goes over this in great detail. I started with that script and then modified it to suit my needs.
We must be looking at different standard assets, because I saw nothing about anything regarding slopes.
EDIT: I did see something in the RigidbodyFirstPersonController, but there were 0 details about it, such as what it does, why it does it, or when it is applied. Not exactly detailed
Since I’m moving the character by changing it’s velocity, this unfortunately isn’t an option. A work-around was to unfreeze or freeze rigidbody constraints when my controller script checks if the player is pressing a movement key or not.
I don’t think it’s the best work-around, but… for now.