HOME | DD

Published: 2007-06-01 15:10:27 +0000 UTC; Views: 7671; Favourites: 57; Downloads: 146
Redirect to original
Description
I added some more code into my circle collision, now its super awsome!*UPDATE*
You can now create balls to.
Related content
Comments: 44
monkeymenace [2008-06-29 04:18:33 +0000 UTC]
ack! added too many balls!!!!! Now just looks like bubbling soda...and i cannot stop it!!!!!!
👍: 0 ⏩: 0
Haysend [2007-09-07 12:08:00 +0000 UTC]
It's really good. I had to make something similar to this. I made each circle find out the angle each one collided at and then pushed them both back across that angle. E.g if one was above the other it would be 90 degs and push them both away across the Y axis. But it seems to be very slow on the collision detection, how did you do yours?
👍: 0 ⏩: 1
Supa-Monky In reply to Haysend [2007-09-08 01:57:06 +0000 UTC]
i used pythagorus to calculate the distance between the balls, then checked if it was smaller than the raduis's combined. Then instead of using sin and cos and having to calculate an angle i just use the rules.
xd = p2.x - p1.x
yd = p2.y - p1.y
dis = Math.sqrt(xd*xd+yd*yd)
if(dis < p1.r+p2.r){
force = p1.r+p2.r-dis
p1.vx -= xd/dis*force
p1.vy -= yd/dis*force
p2.vx += xd/dis*force
p2.vy += yd/dis*force
}
Thats the simple version, though mines more optimised
👍: 0 ⏩: 1
awesty In reply to Supa-Monky [2007-12-29 09:26:36 +0000 UTC]
So kind of like verlet integration, with the distance of the combined radius'?
👍: 0 ⏩: 0
harrypottergeek [2007-06-27 00:53:20 +0000 UTC]
the balls wont stop bumpin into each other causin MAJOR k-os, AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
THEY WONT STOP!!!!!!!!!!!!!!!!!!!!!!
👍: 0 ⏩: 0
Sne-aks [2007-06-03 04:00:18 +0000 UTC]
if you create like 20 - 30 balls in the upper corner right in a row...it all collides and makes a perpetual collision machine that never stops...hehe
👍: 0 ⏩: 1
fudging [2007-06-02 11:36:58 +0000 UTC]
Ooh, add enough balls and one good fling results in perpetual motion
👍: 0 ⏩: 1
fudging In reply to Supa-Monky [2007-06-03 10:40:27 +0000 UTC]
Have you got the balls to do it?
👍: 0 ⏩: 1
Aspherin [2007-06-02 05:56:47 +0000 UTC]
good work man, sometimes the balls go nuts tho...this for your uber-physics rpg?
👍: 0 ⏩: 2
Supa-Monky In reply to Aspherin [2007-06-02 10:33:33 +0000 UTC]
not really, the collision has some problems when its got constraints with this method
👍: 0 ⏩: 0
Supa-Monky In reply to Aspherin [2007-06-02 10:33:03 +0000 UTC]
nah its using my AS3 physics engine
👍: 0 ⏩: 0
psykopath [2007-06-02 04:01:31 +0000 UTC]
Sick. Sometimes it looks like the balls dont actually collide tho, it looks like it detects they will and take then does the collision anyway, and you dont get totsee the moment when they collide. Maybe its just me seeing things.
👍: 0 ⏩: 1
Supa-Monky In reply to psykopath [2007-06-02 05:00:54 +0000 UTC]
nah, that actually happens its adding its velocity when it calculates the distances between the balls
👍: 0 ⏩: 0
Dshark [2007-06-02 03:46:01 +0000 UTC]
Haha, that's badasss! Never had so much fun playing with balls.
Am I allowed to say that?
👍: 0 ⏩: 1
Supa-Monky In reply to robphillips [2007-06-02 01:15:18 +0000 UTC]
Its impossible to play with it too long
👍: 0 ⏩: 0
ZaneAsylum [2007-06-01 16:33:09 +0000 UTC]
i like how you can create a ball ,swing it around so that it can pick up speed, then let it go so that it crashes into the balls at the bottom making a bunch of them shoot into the air as a result
👍: 0 ⏩: 1
DCLeadboot [2007-06-01 16:02:33 +0000 UTC]
I like how you can grab a ball in this one!
I take one and fling it into the pile and the resulting chaos is like a load of spilled ping-pong balls!!
👍: 0 ⏩: 1
AnnonymosREBORN [2007-06-01 16:00:27 +0000 UTC]
zomg u added the add ball thing just like that!??!
👍: 0 ⏩: 1
Supa-Monky In reply to AnnonymosREBORN [2007-06-02 01:11:31 +0000 UTC]
the adding ball thing? yes
👍: 0 ⏩: 1
NinjitsuWarrior [2007-06-01 15:11:40 +0000 UTC]
Awesome thing!
Maybe add a function to add one yourself?
👍: 0 ⏩: 1