|
-
Senior Member
[AS2] Ball Collision & Momentum. Yay >_<'
Oh yeah, ball collision. Ain't that a fun subject?
So I'm trying to make two balls collide and by the law of momentum conservation (Or however it's called in English :S ), have them moving at the correct different directions and speeds.
It's sort of like a pool game 
I got the balls moving, got a way to find out when they collide and then started trying to make the hitting ball (let's call it cueball xD) to move back.
Since I've made my balls movement directions angle based (as in x+=cos(angle)*r) I figured all I got to do is change the angle by 180 degrees.
Which sounded logically correct.
But what I forgot is that it'll also flip the y movement. So I made "xangle" and "yangle" and then only changed the "xangle" by 180. That seemed to work, only with no realistic physics.
If the cueball hits exactly at the center of the other ball by moving only on the X line, then obviously, it'll move back on the X line (Though since they both have the "same mass" it should stop, but I don't want that). In that case all I need to do is add 180 degrees to my xangle.
But what if it hits 30 degrees below the center of the other ball?
I've been working on this project and a few more for almost 15 hours now. And have been typing all sorts of complicated and useless lines to try and get the collisions to work. I've read pool table equations and gone through dozens of websites. I searched for pool tutorials (and only found on messed up source code and another badly explained tut).
I also found a very old thread on this forum regarding almost the same subject but beside of theoretical info, it didn't help me at all.
At this point I don't even know if this subject is very simple and all I need is a good sleep or it's pretty complicated and I won't get any help here :/
Either way I'm going to keep on trying right now. Any sort of help, any, is welcome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|