$begingroup$

I’m making an attempt to determine the speed of ball A after collision which is V2.A as seen within the determine. I do know that the speed of ball A when collision happens is perpendicular to the road connecting centre of ball A and B when the collision happens.

enter image description here
(Image taken from: http://www.real-world-physics-problems.com/physics-of-billiards.html)

Issue is, my V2.A is typically flipped in wrong way, and I can not appear to determine the difficulty right here. Here’s my V2.A calculation

Vector2 diff = (b - a).normalized;  
Vector2 perpendiular = Vector2.Perpendicular(diff);

Thank you!

$endgroup$

$begingroup$

See Vector2.Perpendicular:

Returns the 2D vector perpendicular to this 2D vector. The result’s all the time rotated 90-degrees in a counter-clockwise course for a 2D coordinate system the place the optimistic Y axis goes up.

In this case, simply choose whether or not the unsigned angle between the speed vector of ball A and the outcome vector is larger than 90 levels:

Vector2 diff = (b - a).normalized;
Vector2 perpendiular = Vector2.Perpendicular(diff);
if (Vector2.Angle(directionOfA, perpendiular) > 90)
{
    perpendiular = -perpendiular;
}

$endgroup$

You should log in to reply this query.

Not the reply you are searching for? Browse different questions tagged .