Alright, so I'm working on a pinball game on JS/Canvas and I'm wondering how to handle the collision between the flipper and the ball.
I can get the flipper to hit the ball, but I'm confused about how to change the ball's velocity direction with varied flipper positions (angles). Here's the information that I could use from both a flipper and ball:
this.ballPosX = ballPosX;
this.ballPosY = ballPosY;
this.ballVelX = 0;
this.ballVelY = 0;
// thruster is a line shape with a variable end Y position
ctx.moveTo(125, 480);
ctx.lineTo(215, this.posY);
I'm not calculating the velocity of the flipper btw. I just want to know how to change the ball velocity vector director with regards to the slope of the line. Thanks!