PDA

View Full Version : collision detection


zoviac
11-02-2002, 05:48 AM
any good tutorials on this?
i didnt find no good ones..

stuka
11-02-2002, 12:25 PM
what collisions are you trying to detect?

sans-hubris
11-03-2002, 01:11 AM
Ah, that fun thing. I actually have to do some collision detection programming right now myself.

What sort of objects do you need to do collision detection on? That's the most important question you can ask yourself right now. Some shapes are extremely easy to do collision detection with.

zoviac
11-03-2002, 05:47 AM
well... anything.. pixel, ascii characters, pcx image..

zoviac
11-04-2002, 01:04 PM
btw, i wrote this little program, it has a nice ascii character running around the screen, but when it touches the wall, the collision gets fucked up, it jumps 2 (pixels? what u call those)..
so it cant go too close to the wall. check it out yourself.
(sorry, no comments, but it should be easy for u pros :)

zoviac
11-04-2002, 01:05 PM
btw, i wrote this little program, it has a nice ascii character running around the screen, but when it touches the wall, the collision gets fucked up, it jumps 2 (pixels? what u call those)..
so it cant go too close to the wall. check it out yourself.
(sorry, no comments, but it should be easy for u pros :))

Come on, someone gotta be able to help
if not, give me any kind of collision detection tutorials

Kamikaze!
11-23-2002, 10:25 AM
I found something useful about circle collision: http://artsandtechnology.humber.ac.uk/~rcarter/tutorials/lesson8.pdf

Edit: I jus tried it and it works very well.

sans-hubris
11-23-2002, 12:13 PM
Let's take the easy case with circles, really quickly. Think about the shape of the circle. Any point on the circle is going to have the same distance from the center as any other point on the circle. That distance is what mathematicians call the radius. Let's say you have two circles that are touching. How do you know that they are touching (or are intersecting)? Given that the first circle at point p1 has a radius of r1 and the second circle at p2 has a radius of r2, then you know that they are colliding if the distance between p1 and p2 is less than r1 + r2. See? That wasn't hard, now was it? That's what I mean by understanding the math behind the objects that you're colliding.

Figuring out what those calculations are supposed to be might be easy, but they may not be cheap (processor-time-wise, that is.)

PS That tutorial above makes it sound like collision detection is a lot more complex than it really is. Plus, it makes use of the term "vector" incorrectly. Vectors have direction, not length. They really should have used the term "line segment" instead.

Strike
11-23-2002, 02:58 PM
Originally posted by sans-hubris
PS That tutorial above makes it sound like collision detection is a lot more complex than it really is. Plus, it makes use of the term "vector" incorrectly. Vectors have direction, not length. They really should have used the term "line segment" instead.
That's not entirely true. Vectors implicitly have magnitude, not really direction. What exactly that magnitude is representing can indeed be direction, but it can be many other things as well, including length.

stuka
11-24-2002, 02:51 PM
Actually, in the geometric sense, a vector has a magnitude AND a direction. Hence velocity is a vector, while speed is a scalar equal to the magnitude of the velocity. Wheres scanez when ya need 'im?

zoviac
11-24-2002, 02:54 PM
shit, this is getting hard for me, u got anything more simple, like adom or angband type collision detection?

i mean like this:

#########
#.......&......#
#.@...........#
#...............#
######### the '@' should collide with walls (#) and the '&'