Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Calculating angle of reflection ???

This topic is 6478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, i''m writing a game similar to snooker. The difference is that all the coins/balls are not of the same mass and its 2D ! Ok getting to the point, the problem i''m facing is finding the direction vector of coin2 after collision has occured. Say i have two coins/balls c1 and c2 having masses m1 and m2 respectively. c2 is stationary and c1 is moving with a velocity v1 towards c2. i figured out in which direction to reflect c2 - c2 will move along the collision line ( the line connecting the centers of the two coins at the point of contact i.e when the distance b/w the centers of the two coins equals the sum of their radii ) - am i right ? in which direction do i reflect c1 ? How do i calculate the direction vector ?

Share this post

Link to post
Share on other sites
Well that depends. If the center of mass of c1 is heading directly at the center of mass of c2 when the collision occurs, there won''t be a vector change for c1, although it could be inverted if the mass of c2 is great enough to reverse the momentum of c1...I''m not 100% sure.

But if c1 hits c2 at some skew angle, you gotta a lot of math to do, and I can''t help you there.

Share this post

Link to post
Share on other sites
I might work this out for myself soon, but here''s how you would go about it.

We can say that horizontal momentum is conserved, as is vertical. Then we can say that kinetic energy is conserved, too. It wouldn''t be in reality, but it''d be close enough.

Also, knowing that the forces acting on the coins can only act in the direction of the "collision line", you have now got enough information to calculate where the coins go next. The calculations won''t be easy, but there''s no other way, really.

Share this post

Link to post
Share on other sites
i read about that in "Fundamental of Physics" by Halliday and Resnick

They''ve given two equations to calculate the final velocities of the two bodies after an elastic collision

V1F = (M1 * V1I - M2 * V1I + 2 * M2 * V2I) / ( M1 + M2)
V2F = (M2 * V2I - M1 * V2I + 2 * M1 * V1I) / ( M1 + M2)

Well this gives me the final velocites of the coins. i''ll have to apply only a portion of the final velocities to the coins based on the angle at which they collide. This could be achieved by taking the cosine of the angle and multiplying it with the final velocities.

Something like this

V1F = cos(angle b/w c1 and c2) * V1F

i think this is how its done but not very sure.

right now i''m cluless bout the angle in which coin2 will travel after collision !

i know that if coin1 collides with coin2 head on, then coin1 will follow coin2 ( provided coin1 is of a greater mass than coin2 ) but what happens if they collide at some skew angle as Zipster said ???

if someone here could just give me the equations with which i have to work it would of great help !

Thanks in advance

Share this post

Link to post
Share on other sites
try these equations

C1 hits C2

looking top down
C1 moves off to the left
and c2 moves off to the right


the y component of c1 is V1 sin @
the x component of c1 is V1 cos @

the y component of c2 is -V2 sin @
the x component of c2 is V2 cos @

.5*M1*(V1i^2) = .5* M1* (V1f^2) + .5*M2*(V2f^2)

Share this post

Link to post
Share on other sites
Nice equation. Lettuce see...

u means initial velocity.
v means final velocity.
impulse means change in momentum.
head means what would happen in a head-on collision.
real is what really happens.

Head_v1 = (m1*u1 - m2*u1 + 2*m2*u2) / (m1+m2)
Head_Impulse1 = m1 * (Head_v1 - u1)
Real_Impulse1 = Head_Impulse1 * cos(Angle)
Horz_Impulse1 = Real_Impulse1 * cos(Angle)
Vert_Impulse1 = Real_Impulse1 * sin(Angle)
Horz_Impulse2 = -Horz_Impulse1
Vert_Impulse2 = -Vert_Impulse1

That looks right to me. Just remember that those final results are impulses, and you will need to divide them by the appropriate mass to get the change in actual velocity.

EDIT: changed a 2 to a 1. 'twas a silly mistake, really.

Edited by - Beer Hunter on March 21, 2001 1:24:35 AM


I'm editing this post instead of posting twice in a row.
I've tested the stuff I posted and it works very nicely. But take note though, that when you use this sort of collision detection, when two objects collide, you should project back to the actual point in time at which they collide, then perform the collision code, then bring them back to the true time. It sounds hard, but it'll avoid nasty bugs, such as two objects overlapping and "colliding" twice. It's made a lot easier, though, because the objects are circular.

Edited by - Beer Hunter on March 21, 2001 11:56:52 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!