hyperandroid / CAAT

Canvas Advanced Animation Toolkit
hyperandroid.github.com/CAAT
MIT License
727 stars 117 forks source link

collision image #166

Closed nunziofiore closed 10 years ago

nunziofiore commented 10 years ago

Hi I used Caat in a company project and it's coool. I'va only a limit and I wish someone can help me.

The project is a planner. We have a left bar and we drag from left to our canvas some little image (images rapresent stuff that you can find in a room: table, chair and so on). Every image is a little png with alpha transparency. We have to determine if two image collide but, using collision on two Actor is easy but we are going crazy in finding the collision only of the drawn part of the image and not the transparency. My english is terrible, I wish you understand the problem. There's a way to show collision of drawn part of two transparent png? Nunzio

ixdi commented 10 years ago

Why you don't use Box2D ? There's some info about pixel-perfect collision here: http://www.learn-cocos2d.com/2011/12/fast-pixelperfect-collision-detection-cocos2d-code-1of2/

nunziofiore commented 10 years ago

But is in js? Sorry perhaps I don t userstand, but I see Xcode on your link. Nunzio

Il lunedì 31 marzo 2014, ixdi notifications@github.com ha scritto:

Why you don't use Box2D ? There's some info about pixel-perfect collision here:

http://www.learn-cocos2d.com/2011/12/fast-pixelperfect-collision-detection-cocos2d-code-1of2/

Reply to this email directly or view it on GitHubhttps://github.com/hyperandroid/CAAT/issues/166#issuecomment-39144005 .

Nunzio Fiore

nunziofiore commented 10 years ago

I saw it @ixdi and is great but is on polygon not on images with alpha..... have you got some demo about images?

ixdi commented 10 years ago

Yes, that link only show concepts and strategies. I think it's not difficult to rewrite that functions in js although a simple google search will show you more specific info: "js pixel-perfect collision".

The easy way is Box2D.

Sometimes pixel perfect collision is not required to ensure feels fair.

nunziofiore commented 10 years ago

thank you, I'll study it