Having 2 moving entity detect collision.

Blitz3D Forums/Blitz3D Programming/Having 2 moving entity detect collision.

Craig H. Nisbet(Posted 2004) [#1]
I Have two entities(balls) that are moving and I want to trigger a bounce effect on both balls like pool balls, but as it stands blitz will only trigger a collision response for one of the balls cousing 1 ball to bounce and the other to just sit there uneffected. Is there a way to register a collision for both entities?


GitTech(Posted 2004) [#2]
If the distance between the two balls (measured from the center of the balls) is equal to, or less than the sum of the radius of both balls, then there's a collision.

if entitydistance(ball1,ball2)<=radiusBall1+radiusBall2 then
    ;Collision
endif



Craig H. Nisbet(Posted 2004) [#3]
That's what I ended up using and it works!! Whoohoo


AdrianT(Posted 2004) [#4]
Jeremy is doing some blitz intercollision with vibrating balls. You would have to ask him to explain though heh. Since your doing spheres though, you probably don't need anythig more than your doing allready.