Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-19-2011, 05:27 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 17
bublen is on a distinguished road
Default UIImageView and CGRectIntersectRect

Hi everybody, I have a question not so easy to explain. I try and sorry for my bad english

I have 2 UIImageViews which size are 50x50 and 60x60 pixel.

I use CGRectIntersectRect method to determinate when one image touches the other. but these 2 images are 2 balls and sometimes code determinates that these images are touching themselves when "with your eyes" you can see they don't touch. This happens because balls don't "cover" all spaces of image. so same corners of images are clear, but of course code doesn't matter about this.

The question is: how can I solve? how can I determinate frame of images that follow perfectly the circonference of balls?

I hope it's clear.

Thanks to all,

hello
bublen is offline   Reply With Quote
Old 12-19-2011, 08:32 PM   #2 (permalink)
almostfunnydev
iPhone Dev SDK Supporter
 
rocotilos's Avatar
 
Join Date: Oct 2009
Age: 34
Posts: 3,015
rocotilos is on a distinguished road
Default

Use.. er.. i think it is called.. Pythogoras Theorem?

You are having balls, so it is easy to check more accurate collision, since the objects are circles.

for eg,

uiimageview ball1,ball2

dist = sqrt(ball1.posx*ball1.posx + ball2.posx*ball2.posx);

// then do same for disty

then they collide, when dist< (ball1.radius+ball2.radius).
rocotilos is offline   Reply With Quote
Old 12-20-2011, 12:51 AM   #3 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 17
bublen is on a distinguished road
Default

Quote:
Originally Posted by rocotilos View Post
Use.. er.. i think it is called.. Pythogoras Theorem?

You are having balls, so it is easy to check more accurate collision, since the objects are circles.

for eg,

uiimageview ball1,ball2

dist = sqrt(ball1.posx*ball1.posx + ball2.posx*ball2.posx);

// then do same for disty

then they collide, when dist< (ball1.radius+ball2.radius).
I just say balls for example
bublen is offline   Reply With Quote
Old 12-20-2011, 01:18 AM   #4 (permalink)
almostfunnydev
iPhone Dev SDK Supporter
 
rocotilos's Avatar
 
Join Date: Oct 2009
Age: 34
Posts: 3,015
rocotilos is on a distinguished road
Default

Quote:
but these 2 images are 2 balls
You are saying they are balls. And not an "example".

You need to be specific when asking questions because answers
will vary according to your details. If you have a character of a person
instead, then I can't help u. If it is just circles, then that's the answer
I posted before.

Pls state your question properly next time.
rocotilos is offline   Reply With Quote
Old 12-20-2011, 01:35 AM   #5 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 17
bublen is on a distinguished road
Default

Quote:
Originally Posted by rocotilos View Post
You are saying they are balls. And not an "example".

You need to be specific when asking questions because answers
will vary according to your details. If you have a character of a person
instead, then I can't help u. If it is just circles, then that's the answer
I posted before.

Pls state your question properly next time.
Yes sorry, I didn't think to that. Does anyone know how can I solve if we're talking about 2 characters?
bublen is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 379
10 members and 369 guests
apatsufas, comicool, Creativ, Dalia, dansparrow, husthlj, LunarMoon, mer10, Murphy, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,677
Threads: 94,127
Posts: 402,916
Top Poster: BrianSlick (7,990)
Welcome to our newest member, husthlj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:03 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0