Collision Jitter
Introduction
Simple Bouncing Collision Example
if(ball.CollideAgainst(rectangle))
{
// This is not a FlatRedBall call, but I'll pretend it is for simplicity
Side side = ball.SideOn(rectangle);
if(sideOn == Side.Right || sideOn == Side.Left)
{
// Collided on the left or right side so invert the XVelocity.
ball.XVelocity *= -1;
}
if(sideOn == Side.Top || Side.Bottom)
{
// Collided on the top or bottom side so invert the YVelocity.
ball.YVelcity *= -1;
}
}What Causes Collision Jitter
Solutions for Collision Jitter
Repositioning After Collision
Selectively Inverting Velocity
Last updated
Was this helpful?



