I implemented a simple AABB and Circle collision system in my engine. It mostly works ok but sometimes I get really weird effects.
When a Circle touches (collides) AABB, sometimes it doesn't bounce right away but it enters into the box. It's barely noticeable and when it enters ti doesn't automaticaly go out but it wiggles for bit and after 1-5s it exists in correct direction.
This is my code to change direction after Circle collided with AABB (collision returned true):
if (psprite->Tag() == TagType::WALL_LEFT)
{
dir = Vector2(-dir.x, dir.y);
}
Where psprite is a Wall sprite and this code is located in Ball class (Circle collider).
Have you encountered something similar? I just can't figure what's wrong.