Recreation Improvement Stack Trade is a query and reply website for skilled and unbiased sport builders. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
The very best solutions are voted up and rise to the highest
Requested
Seen
8 occasions
I’m attempting 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.
(Picture taken from: http://www.real-world-physics-problems.com/physics-of-billiards.html)
Challenge is, my V2.A is usually flipped in other way, and I am unable to appear to determine the problem right here. This is my V2.A calculation
Vector2 diff = (b - a).normalized;
Vector2 perpendiular = Vector2.Perpendicular(diff);
Thanks!
$endgroup$
Returns the 2D vector perpendicular to this 2D vector. The result’s at all times rotated 90-degrees in a counter-clockwise path for a 2D coordinate system the place the constructive Y axis goes up.
On this case, simply decide whether or not the unsigned angle between the speed vector of ball A and the end result 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 could log in to reply this query.
Not the reply you are in search of? Browse different questions tagged .
lang-cs