Dash - Stuck on walls collision detection
❄️
2
Quick and easy fix for when player uses the Dash Ability and collides with a wall. You might notice they get stuck!
This is because the player remains in a pushed state, continuously attempting to move into the wall on each frame until the push intensity decayed to zero.
Open Movable.cs In ExecutePushOrder() (Line 450) Remove:
if (pushOrder.intensity > 0.2f)
{
bool movementSuccess = TryMove(pushOrder.direction, pushOrder.intensity);
pushOrder.intensity = math.lerp(pushOrder.intensity, 0.0f, Time.fixedDeltaTime * pushOrder.resistance);
m_pushOrder = pushOrder;
if (!movementSuccess)
{
foreach (GameObject go in m_castCollisionSet)
{
if (m_pushOrder.Value.AddCollision(go))
{
CollisionDispatcher.RegisterCollision(this, go);
}
}
}
}
And replace it with:
if (pushOrder.intensity > 0.2f)
{
bool movementSuccess = TryMove(pushOrder.direction, pushOrder.intensity);
if (!movementSuccess)
{
foreach (GameObject go in m_castCollisionSet)
{
if (m_pushOrder.Value.AddCollision(go))
{
CollisionDispatcher.RegisterCollision(this, go);
}
}
m_pushOrder = null;
}
else
{
pushOrder.intensity = math.lerp(pushOrder.intensity, 0.0f, Time.fixedDeltaTime * pushOrder.resistance);
m_pushOrder = pushOrder;
}
}
Fixed! The push order is immediately canceled when TryMove() returns false (indicating a collision). This will allow the player to regain full control immediately after hitting a wall.
Dash - Stuck on walls collision detection

💬 Comments (2)
Want to continue the conversation?