Open Stevepunk opened 8 years ago
To resolve this I added an extra grounded check when encountering a wall: (assuming that if we're grounded and not moving sideways then we also don't want to move vertically either)
// These mean we can't progress forward. Either a wall or a slope
if (HasFlag(CollidedSurface.LeftWall) &&
_velocity.x < 0 &&
_collidedNormals[DIRECTION_LEFT] == Vector2.right ||
HasFlag(CollidedSurface.RightWall) &&
_velocity.x > 0 &&
_collidedNormals[DIRECTION_RIGHT] == Vector2.left)
{
if (IsGrounded())
{
velocity = Vector2.zero;
}
else
{
_velocity.x = 0;
}
}
This resolved the problem for most speeds, but when travelling at fast speeds with a slow computer I found that I had to increase Environment Check Distance from 0.02f to 0.1f.
On even slower computers it may need to be increased more or there may be a more efficient solution..
I see you have a fork. Can you please commit an example scene and the fix so We can take look.
Is this when encountering a wall or a steep slope?
Also, given that this is in FixedUpdate then it shouldn't matter if the computer is fast or slow.
I've also seen this problem and tried the fix from Mr-Sheen a few posts up. It seems to fix the issue in most cases but if the character hits a vertical wall while running up a slope at too high a speed he'll do a little jump/bounce.
All the slopes in my game are 45 degrees, with all other colliders being perfectly horizontal or vertical.
Moving from walkable slope to wall causes a bounce and stick to wall. I doubt this is intended. Each time the player moved against a wall from a slope he bounced up instead of standing still.
He does this even if the minimumSpeedToMoveUpSlipperySlope is set to a large number to stop the player from attempting to climb slopes that he is not able to.
Everything else works great even with procedurally generated meshes/colliders! Awesome work indeed!