Elemantary collsion in a 3D-World

Started by
1 comment, last by cruiz 22 years, 7 months ago
Hi! I need collision in a 3d-WOrld. For example in a 3DShooter. I need a collison with bottom and walls. But I don''t know how!! I have heared of: ax+by+cz+d=0 And someone had explain me how it works but I still don''t know how it works. I''ve read alot of physics and maths about vectorgeometry and so on but nothing... I''m in the dark! PLZ help me!! I don''t know what do do now! Greets: C.Ruiz P.S.: Sorry, my bad english!
Advertisement
It sounds like you may need to read a variety of different presentations in order to achieve a good understanding of the fundamentals of vector geometry and the equation of the plane. I''d suggest doing a web search and just read several different articles. Everyone will describe things a bit differently and perhaps one description will be clear to you.

I can offer a couple of web sites:

A tutorial on basic collision detection at flipcode:

http://www.flipcode.com/tutorials/tut_collision.shtml

And a web page that points to several software tools for collision detection (this material can be rather advanced):

http://www.ams.sunysb.edu/~jklosow/quickcd/QCD_resources.html

Hope this helps.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
I can tell you one more thing that may be useful. Your equation:

ax + by + cz + d = 0

is the equation of a plane in 3-dimensional space. Every point (x,y,z) on the plane satisfies the equation. The thing that may be useful to know is that the coefficients a, b, and c actually are the terms of a vector that is normal (perpendicular) to the plane. Thus the normal (normal.x, normal.y, normal.z) is actually equal to (a, b, c). Lets look at an example. If you have a plane that is perpendicular to the z axis (the plane is parallel to the ax plane) then you define the plane''s normal as a unit vector along the z axis. Its normal would be:

normal.x = 0 = a
normal.y = 0 = b
normal.z = 1 = c

You can see that (a, b, c) is a vector that points in the z direction, (0, 0, 1).

And so the equation of that plane would be:

0x + 0y + 1z + d = 0

or:

z + d = 0

or:

z = -d

Now, x and y don''t show up in the equation. What that means is that you can pick *any* value of x and y, and z will always be equal to -d.

Suppose you want the equation to be at the level of z = 5 (say, 5 feet off the ground, with the ground at z = 0 feet). Then you must pick d = -5 so:

z = -d = -(-5) = 5

If you can find the normal of a plane (say, by finding the cross product of two vectors known to be in the plane) and you know 1 point on the plane, then you can find a, b, c, and d. First, find the normal and plug those in as a, b, and c. Then pick the point on the plane, and solve for d as:

d = -ax - by - cz

So, that is just a little clue/tidbit of information.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement