Received: by 10.114.107.19 with SMTP id f19mr7928654wac.2.1228411231737; Thu, 04 Dec 2008 09:20:31 -0800 (PST) Return-Path: Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.239]) by mx.google.com with ESMTP id m37si6278087waf.0.2008.12.04.09.20.30; Thu, 04 Dec 2008 09:20:30 -0800 (PST) Received-SPF: pass (google.com: domain of shayne.one...@gmail.com designates 209.85.198.239 as permitted sender) client-ip=209.85.198.239; Authentication-Results: mx.google.com; spf=pass (google.com: domain of shayne.one...@gmail.com designates 209.85.198.239 as permitted sender) smtp.mail=shayne.one...@gmail.com; dkim=pass (test mode) header...@gmail.com Received: by rv-out-0506.google.com with SMTP id g9so3758615rvb.0 for ; Thu, 04 Dec 2008 09:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=NFftvG7ZqIssIoAMU1PKzPppsPlNHhRvOr0WQ+9sZ+4=; b=Sex8lkXVqAWZTkUQZ3FAuFkj2LdMwMEJKmU8ErbzwBiH0dkqPYyrY9Cl0b2libyTyv mJis2nzAsy6PLnbM56qdEApEL5xQfIIYINEE5fsxHxy9/tyjfrDbdoC6rLgriV7tpbiE fFZeOs5EusEyLYJl0EUUVXgY/hduTQxibLBcw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=bu4wXEiYZi9LKJ3Jj1rzMnQvvccA4Ebqd7fcUTqaL1VnrDoETQ5Mf2sxAHlTA+SYqz +hRBE2UEGuGFK7jhkOGu5zxo0OUWD0QvN+rjiEeazx1Vds5GAZKqMLh/WKgsVb0Z46yQ aeCANoIQrzzH+eeuV15XVnHk0tY21umIUrJm4= Received: by 10.141.49.18 with SMTP id b18mr7046851rvk.96.1228411230636; Thu, 04 Dec 2008 09:20:30 -0800 (PST) Return-Path: Received: from ?10.1.1.32? (CPE-124-182-160-222.sa.bigpond.net.au [124.182.160.222]) by mx.google.com with ESMTPS id g31sm15901179rvb.7.2008.12.04.09.20.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Dec 2008 09:20:29 -0800 (PST) Message-Id: <10021533-7FB0-4797-825B-584F5AFE0...@gmail.com> From: Shayne O'Neill To: cocos2d-iphone-discuss@googlegroups.com In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: Strategies for collision detection. Date: Fri, 5 Dec 2008 02:20:00 +0900 References: <576671f4-ac39-4d9f-8960-190949b81...@g38g2000yqn.googlegroups.com> <996ec470811301027y3e59dad9r55dea39abf334...@mail.gmail.com> <3522a0a2-04c6-4963-ac1b-072b8431e...@n10g2000yqm.googlegroups.com> <996ec470812030914o620668d3pc266bc8fd641b...@mail.gmail.com> <06dbb5ef-01ea-402a-8a64-66c076fe3...@x8g2000yqk.googlegroups.com> <996ec470812031021g3f0ec161ge1673affa401d...@mail.gmail.com> <0ba6139d-0574-4cff-90d1-691a67dea...@n10g2000yqm.googlegroups.com> <996ec470812031631r512075ddiebb547434b627...@mail.gmail.com> X-Mailer: Apple Mail (2.929.2) I had an idea on how to implement collision detection, and get touch handling as a freebie. It strikes me that with this talk of collision detection, that a well concieved foundation for it would probably work well as the basis for a touch control api as well. essentially if there was something like the ability to nominate something like a 'channel' or something that cocosnodes can be registered to, and if there is a collision on that channel, then that 'channel' will then do a callback. So basically all the cocosnodes registered to the 'channel' tell the 'channel' whenever their rect intersects with another rect in that channel which sends the rects to the callback. So I could do something like channel = [[cocosChannel init] registerCallback:obj selector:selector(callback:)] [[[[channel add:sprite1] add:sprite2] add:sprite3] and from then on, if any of those sprites collided the object nominated in the channel would recieve a message like [obj callback:] From there one imagine a special cocosnode that exists as a singleton called something like cocosTouch, and all someone has to do is add that node to a channel, and if the user touches one of the sprites in that channel , the callback is triggered So I could do controls = [[cocosChannel init] registerCallback:controller selector:selector(doControls:)] [[[[controls add:leftArrowSprite] add:rightArrowSprite] add:upArrowSprite] add:downArrowSprite] and whenever one of the 4 arrows is pressed, it calls the callback with a reference to the arrow pressed. That'd make touch control really elegent, and it'd be very easy to implement as a side effect of adding collision detection. Which kills 2 birds with one stone, as the saying goes. I hope this all makes sense. Shayne.