Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 OVal detection
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BenLi




PostPosted: Thu Jun 29, 2006 4:51 pm   Post subject: (No subject)

well perhaps with whatdotcolor you could designate points on the player's fish's mouth that could detect when it touches another color
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Thu Jun 29, 2006 5:05 pm   Post subject: (No subject)

well the only problem with that theory, is that, what happens if the point that you are checking with View.WhatDotColor misses the color you are looking for and you end up going to the wrong place? the best idea in this case would be to use some math and come up with some kind of algorithm to figure out collision detection with ovals
Mazer




PostPosted: Thu Jun 29, 2006 8:39 pm   Post subject: (No subject)

The whatdotcolour approach screams of Andy tutelage, but the whole "mouth" thing was a good idea. If two fishes' tail fins touch they aren't eating each other, so why check for such a collision? You'd (that is, anyone attempting a similar problem would) probably want to specify a point for the mouth and do circular colision detection (with a relatively small radius) with the other ovals.

If you're at all serious about game development, let go of whatdotcolour. And if you're not, you needn't worry about collision detection! Wink
BenLi




PostPosted: Fri Jun 30, 2006 6:47 pm   Post subject: (No subject)

true. Well, to simplify the problem, you can try designating a ratio of x radius to y radius. The fish will be similar...
MysticVegeta




PostPosted: Sun Jul 02, 2006 11:30 am   Post subject: (No subject)

Is it me or did my post before just disappeared?

Anyways, Like that I said before (in my deleted post) you lose accuracy with whatdotcolor, thats why I was making a second method after making the loop method which uses major and minor radii but apparently its deleted for some reason.
zylum




PostPosted: Sun Jul 02, 2006 5:30 pm   Post subject: (No subject)

if your just detecting of a fish's mouth is touching any other part of a fish that is really easy. detecting whether a point is in an oval is much easier than detecting whether two ovals are touching.

since you can describe an oval parametrically like so:

x = xRadius*cos(theta)
y = yRadies*sin(theta)

all you really need to know is theta. theta is just the angle between the fish's mouth and the centre of the fish you are collision detecting. using this theta, you find the x and y coordinate where the edge of the oval is. if this coordinate is closer to the centre than the fish's mouth, then there is no collision, otherwise there is a collision.
TokenHerbz




PostPosted: Sun Jul 09, 2006 11:39 pm   Post subject: (No subject)

i see math i once used to know, its a shame i forgot it all :S

Anyone know a good site to refresh my skills in it?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 22 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: