#### Archived

This topic is now archived and is closed to further replies.

# Collision : Smooth surface sliding (Quake series)

This topic is 6668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I''ve finaly added collision detection to my game, but one thing makes me mad about it. You get caught on the walls. How do games like Quake and UT make you slide across the walls without catching? Did I just speak in a riddle? heehehe Please tell me if you don''t understand and I''ll try to simplify a bit better. I''m not good at describing what I want Justin Eslinger

##### Share on other sites
I found out how to do this on accident. All you have to do is multiply the triangle normal by the min. distance from the plane. After the collision occurs.

(I finally figured out how to say it )

------------------------
Captured Reality.

##### Share on other sites
what''s the min. distance from the plane? what is that?
what do you to the velocity or direction vector after the collision occurs,( to slide against the wall )?

quote:
Original post by nes8bit

I found out how to do this on accident. All you have to do is multiply the triangle normal by the min. distance from the plane. After the collision occurs.

(I finally figured out how to say it )

------------------------
Captured Reality.

##### Share on other sites
on flipcode there''s a doc in the Development Tutorials sections called collision detection using bounding ellipoids (or something similar). read it, as it describes in great detail how to "slide" along a surface. allthough it''s for bounding elipsoids (3D ovals), the techniques still apply. go read

CJ

##### Share on other sites
To make you slide along the wall all you do is zero the velocity perpendicular to the wall and leave the velocity parallel to the wall as it is. The min. distance from the plane is the minimum distance from the wall, i.e. the closest you can get to the wall.

##### Share on other sites
quote:
Original post by youngo

what''s the min. distance from the plane? what is that?
what do you to the velocity or direction vector after the collision occurs,( to slide against the wall )?

you do exactally what I say to change the velocity/direction. Actually you don''t change the velocity or direction. All you do is change the position to create the illusion of sliding. Also the "min. distance" is basically how far the player must be at all times from the wall. Without this, you will collide exactally at the plane''s point.

------------------------
Captured Reality.

##### Share on other sites
nes is right. Basically what you are doing is finding the amount that you would have moved parallel to the wall had you kept walking, and taking away any motion normal to the wall. Kind of like breaking down a vector into its x, y values and just moving it in the x direction. Hopefully this clears it up a little.

-BacksideSnap-

##### Share on other sites
I'm pretty glad that I don't sound crazy. It's also very hard to explain without drawing a picture. I'm way too lazy to draw one right now. If you want me to give you an example, just ask. It's gonna require YOU to write some code though. (I do pseudo code )

I don't know why, but I have a feeling you're in San Diego -BacksideSnap-

------------------------
Captured Reality.

Edited by - nes8bit on June 15, 2000 5:01:16 PM

##### Share on other sites
There''s a couple of ways of handling ''sliding'', but here''s the way I do it:

I assume that you have acceleration values for your player, i.e. I call them ax, ay, az. To see if you can move along a wall, just check each component individually.

So, you might have something like this:

x = player_x_coordinate;
y = player_y_coordinate;
z = player_z_coordinate;

ax = requested_acceleration; (or whatever, you get it)
ay = ...
az = ...

// Check each thing separately...
if (Collision(x + ax, y, z))
ax = 0;
if (Collision(x, y + ay, z))
ay = 0;
if (Collision(x, y, z + az))
az = 0;

x += ax;
y += ay;
z += az;

Ok? That''s the way I''ve been doing it in the last 5 years or so. See an example with "Tank Arena 3D" at
www.smidge-tech.co.uk/prog-windows.html

======
Smidge
======

##### Share on other sites
hmm, that''s gonna be a little slow isn''t it?

------------------------
Captured Reality.

1. 1
2. 2
frob
20
3. 3
4. 4
Rutin
17
5. 5
• ### Forum Statistics

• Total Topics
632555
• Total Posts
3007050

×