void ResolveCollision(CollisionInfo info) { //reset to PoI if (info.other is Trampoline) { Vec2 POI = position + (info.ballDistance + radius) * info.normal; position = POI; velocity.Bounce(info.normal, 3f); } //position += velocity * info.timeOfImpact; //velocity.Reflect(info.normal, 0.8f); if (info.other is Wall) { Vec2 POI = position + (info.ballDistance + radius) * info.normal; position = POI; if (info.normal.x > 0) { velocity.x += 0.2f; } if (info.normal.x < 0) { velocity.x -= 0.2f; } if (info.normal.x == 0 & velocity.x > 0) { velocity.x -= 0.2f; } else if (info.normal.x == 0 & velocity.x < 0) { velocity.x += 0.2f; } velocity.Reflect(info.normal, 0.6f); } if (info.other is Shelf) { Vec2 POI = position + (info.ballDistance + radius) * info.normal; position = POI; if (info.normal.x > 0) { velocity.x += 0.6f; } if (info.normal.x < 0) { velocity.x -= 0.6f; } if (info.normal.x == 0 & velocity.x > 0) { velocity.x -= 0.6f; } else if (info.normal.x == 0 & velocity.x < 0) { velocity.x += 0.6f; } velocity.Reflect(info.normal, 0.6f); } grounded = true; }