josephg / Chipmunk-js

Port of slembcke/Chipmunk-Physics to Javascript
http://dl.dropbox.com/u/2494815/demo/Joints.html
536 stars 59 forks source link

Fix collision callback #13

Closed Wu-Hao closed 11 years ago

Wu-Hao commented 11 years ago

Fix collision callback that sometimes don't register or delayed

josephg commented 11 years ago

Uh - hashPair(a, b) == hashPair(b, a)

Wu-Hao commented 11 years ago

no it doesnt in js code

for example collision type 1 and 2.

you created a hashpair["1 2"] notice that it is a string

"1 2" !== "2 1"

Wu-Hao commented 11 years ago

Ok, i was working on a older version of the code, it seams that you fixed it with var hashPair = function(a, b) { //assert(typeof(a) === 'number', "HashPair used on something not a number"); return a < b ? a + ' ' + b : b + ' ' + a; };

so indeed, hashPair(a, b) == hashPair(b, a)

josephg commented 11 years ago

Yep :)