Near Matches
Ignore Exact
Full Text
collision detection
created by
executorpico
(
idea
) by
executorpico
(7.9 y)
(
print
)
?
(
I like it!
)
Thu Jul 27 2000 at 22:14:01
Collision detection
is a way of determining if two objects have (duh) collided in
3d
(or, if you're insane enough to bother,
2d
) space. Some
3D
libraries don't support this out of the box, while many do. It's used almost solely in
game
development, though some
mathematical
applications utilize
vector math
like this.
For this writeup,
camera
=
player
.
Basically, to do
collision
detection, you need to do a few things. First, trace in the direction the
camera
is heading. That will give you the plane you'll be testing on. You need two
vector
s: the normal of the
plane
in the direction you're going and a
vector
from the
camera
to the
radius
of
collision
in the
direction
of the
plane
. Get the
dot product
of these
vectors
:
float DotProduct( Vector v1, Vector v2 )
{
float dot = (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
return dot;
}
If the
dot product
is greater than
zero
, a
collision
has occurred. If the
dot product
is less than
zero
, the
camera
has penetrated the plane. If the
dot product
is
zero
, you're safe. That simple, eh? =-)
And by the way, its a safe bet that your game won't end up like
Rainbow Six
with bodies falling through walls and other crappy effects if you test for
collision
a few loops before you move the
camera
. Otherwise... well, ugh. I'm not buying your
game
.
One last thing,
OpenGL
0wnz j00
. *ahem* *adjusts his lapel*
(
idea
) by
bitter_engineer
(6.4 y)
(
print
)
?
(
I like it!
)
Thu Jul 27 2000 at 22:33:40
Testing for
collision
between two
solid
s is more difficult. A fast way to do it is to just check if any of the
vertices
of either solid exists inside the other solid. This works most of the time, but you can get some
overlap
from
edges
, i.e. two
sword
s might pass through each other if they are swung together. This can be
addressed
by creating redundant
point
s.
printable version
chaos
Collision detection for a first-person shooter
bad sprite programming
The orc that wouldn't die
OpenGL
Cloth Physics
minus world
dot product
event-driven language
Computer and video games : Glossary of terms
no clipping
Common video game design flaws
Collision avoidance technique
CSMA/CD
blarg
Creating a sprite on a Commodore 64
Stupid Unix Tricks
Way of the Samurai
jaypea
Visual Basic
Pythagorean Theorem
Oriented bounding box
2D
Dallas
power-up
Y'know, if you
log in
, you can write something here, or contact authors directly on the site.
Create a New User
if you don't already have an account.
Login
Password
remember me
password reminder
register
Everything2 Help
What you are reading:
Tijuana Bible
Ender's Game
The Imperial Roman Army
Binomial Theorem
Willie Nelson
Jazz Pianists
Vietnam War
Agrippa
Jeff "Skunk" Baxter
how to breathe
How to give a hug
Big O
Old English
Augustine
Vanya on 42nd Street
(
review
)
tentative
Chances Not Taken
(
idea
)
Heitah
Why I love Everything2
(
person
)
trixingee
Dungeon Mastering for the first time
(
idea
)
Netrat0
It's Called Subtext, Honey
(
person
)
eyeofthebeholder
The Dragon
(
idea
)
Heitah
consist, comprise, constitute, or compose
(
idea
)
Meezzio
Gotlandssnus
(
thing
)
argv
Astral Plane
(
idea
)
Madara
One Winged Angel
(
fiction
)
Tom Rook
Talk is cheap
(
poetry
)
shaogo
Adelle Davis
(
person
)
Aerobe
race car g sfjsgsd
(
poetry
)
Binah
Dream Log: July 5, 2008
(
dream
)
StrawberryFrog
Forgotten things in space
(
idea
)
E2 is a by-product of the existence of
The Everything Development Company