Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions > Development Help

Development Help For help from coding to error finding to that one thing you just can't get right

Reply
 
LinkBack Thread Tools
Old 10-28-2009, 04:04 PM   #1 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default Color collison

Hey guys, i need some help with a coding problem and i currently have no code (because i haev no idea how to tackle this problem) Is there a way, where i import a picture, and if an object (a ball, like the ones in the physics engine i posted) hits a certain color, it rebounds ( i know the how to code rebounding code and what not, i just need a detection method) much thanks.

Cheers
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old 10-28-2009, 04:44 PM   #2 (permalink)
lost in paradise with rae
Support Team
Moderator
Expert Zuner
 
Red Sky's Avatar
 
Join Date: Nov 2007
Location: Pennsylvania
Posts: 2,660
Red Sky is just really niceRed Sky is just really niceRed Sky is just really nice
Send a message via MSN to Red Sky
Default

You can use a color map. I'm not exactly sure how to implement it, but check out this link:
2D Collision Detection using a Color Map - Am I getting warmer? - XNA Community Forums





Red Sky is offline   Reply With Quote
Old 10-28-2009, 05:58 PM   #3 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default

hmm there logic/coding is kidna hard to understand, anywho, thanks for helping =)
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote
Old 10-28-2009, 06:20 PM   #4 (permalink)
lost in paradise with rae
Support Team
Moderator
Expert Zuner
 
Red Sky's Avatar
 
Join Date: Nov 2007
Location: Pennsylvania
Posts: 2,660
Red Sky is just really niceRed Sky is just really niceRed Sky is just really nice
Send a message via MSN to Red Sky
Default

generally speaking, I think it uses per-pixel collision detection, which in and of itself is slow.





Red Sky is offline   Reply With Quote
Old 10-28-2009, 06:27 PM   #5 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default

Hmmm, is there any faster method?

so far i have a "Ball" class it defines the, i also have a dot object, i need an easy way to see if a ball has hit a dot
and rather than looping through every dot and ball i was trying to use a color collison method, is there another type of object collison that would work well with many balls/dots?

The ball class has a bunch of info like velocity and position, who has control over it (human or computer) while the dot class is just a vector2 position.
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote
Old 10-28-2009, 06:30 PM   #6 (permalink)
lost in paradise with rae
Support Team
Moderator
Expert Zuner
 
Red Sky's Avatar
 
Join Date: Nov 2007
Location: Pennsylvania
Posts: 2,660
Red Sky is just really niceRed Sky is just really niceRed Sky is just really nice
Send a message via MSN to Red Sky
Default

Why don't you use a more traditional form of collision detection(instead of color collsion?)





Red Sky is offline   Reply With Quote
Old 10-28-2009, 06:40 PM   #7 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default

i just applied an older method i had from a different physics engine,. its works pretty well, but i really wanted color collison so could import a picture of a level and have the game figure out object collison from that, rather then designing a level editor or manual entry.
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote
Old 10-28-2009, 07:16 PM   #8 (permalink)
lost in paradise with rae
Support Team
Moderator
Expert Zuner
 
Red Sky's Avatar
 
Join Date: Nov 2007
Location: Pennsylvania
Posts: 2,660
Red Sky is just really niceRed Sky is just really niceRed Sky is just really nice
Send a message via MSN to Red Sky
Default

With color collision, you'll still need to make a color map that corresponds to the proper collision detection. and I'm sure a physics engine would include ways to easily add collision to an object.





Red Sky is offline   Reply With Quote
Old 10-28-2009, 07:27 PM   #9 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default

Yea, your right, i should build out a good system, so far i have been using bounding spheres, which work really well.
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote
Old 10-28-2009, 07:29 PM   #10 (permalink)
lost in paradise with rae
Support Team
Moderator
Expert Zuner
 
Red Sky's Avatar
 
Join Date: Nov 2007
Location: Pennsylvania
Posts: 2,660
Red Sky is just really niceRed Sky is just really niceRed Sky is just really nice
Send a message via MSN to Red Sky
Default

They're also a more efficient method of collision detection, so you won't have to worry about slow downs. Good luck on your project.





Red Sky is offline   Reply With Quote
Old 10-28-2009, 07:42 PM   #11 (permalink)
Experienced Zuner
 
Join Date: Jul 2008
Location: Kingdom Hearts...Duh
Posts: 221
itsthatsguy is on a distinguished road
Default

Thanks for all your help =)
__________________
go on, buy the melon you started wanting a second ago...




itsthatsguy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools