This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-05-03 05:08:28

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

ball collision detection

Is there someone that would like to show me a good collision detection algorithm between two sprites (e.g. two balls) that move with a costant speed and bounce on edges? Thanks in advance  smile

Offline

 

#2 2008-05-03 05:29:04

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: ball collision detection

This one by colkadome seems to work really well...

http://scratch.mit.edu/projects/Colkadome/115120


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-05-03 06:16:02

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: ball collision detection

Thanks a lot Paddle2See. Colkadome's project is indeed a very neat pool simulation. I'm going to see if I can modify it so to get the constant speed effect that I need.

Offline

 

#4 2008-05-05 07:14:50

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: ball collision detection

I extracted the collision routine from Calkadome's project, simplified it a bit (I hope not to much) and put it in the "perfect collision detection with bounce" project (http://scratch.mit.edu/projects/s_federici/155861).

Thanks a lot for your help

Offline

 

Board footer