Hello. I've been playing with this project a little bit lately and refactored some of it a little bit, primarily moving a couple of bits into fixed update so that the movement physics don't change depending on frame rate.
I'm encountering an issue where my character seems to be "sliding" up slopes. If I stand on a slope and push in a direction up the slope, the character will get stuck travelling in that direction until I return to flat land. If I had to guess it's something to do with the grounding detection, which seems to flicker on and off repeatedly and therefore might be repeatedly adding air acceleration on slopes? I'm not sure exactly how I might diagnose what is happening here though.
This is the segment I moved into FixedUpdate:
private void FixedUpdate()
{
// In FixedUpdate to prevent rate of update scaling with frame rate
if (_controller.isGrounded)
GroundMove();
else if (!_controller.isGrounded)
AirMove();
// Move the controller
_controller.Move(playerVelocity * Time.deltaTime);
}
Any suggestions for how to resolve this would be very welcome!
I'm drifting toward implementing my own isGrounded function to override the default charactercontroller one the script currently uses which I believe is simply a wrapper for if((controller.collisionFlags & CollisionFlags.Below) != 0) which would likely suffer from the physics issue of constantly being "pushed" out of clipping into the ground resulting in the isGrounded fluctuations. Perhaps a short raycast from a transform placed above the base of the controller, or something.
Hello. I've been playing with this project a little bit lately and refactored some of it a little bit, primarily moving a couple of bits into fixed update so that the movement physics don't change depending on frame rate.
I'm encountering an issue where my character seems to be "sliding" up slopes. If I stand on a slope and push in a direction up the slope, the character will get stuck travelling in that direction until I return to flat land. If I had to guess it's something to do with the grounding detection, which seems to flicker on and off repeatedly and therefore might be repeatedly adding air acceleration on slopes? I'm not sure exactly how I might diagnose what is happening here though.
This is the segment I moved into FixedUpdate:
Any suggestions for how to resolve this would be very welcome!
I'm drifting toward implementing my own isGrounded function to override the default charactercontroller one the script currently uses which I believe is simply a wrapper for
if((controller.collisionFlags & CollisionFlags.Below) != 0)
which would likely suffer from the physics issue of constantly being "pushed" out of clipping into the ground resulting in the isGrounded fluctuations. Perhaps a short raycast from a transform placed above the base of the controller, or something.