Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / What is sliding collision

Author
Message
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 5th Jun 2003 23:36
Ya real simple question, what is sliding collion. Also is there a faq with other terms I may need to know what they mean? Thanks.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 5th Jun 2003 23:46
Open an FPS and walk into a wall. You notice that you keep moving, sliding along the wall? That is sliding collision.

As for an FAQ, I'm afraid I don't know.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
Vandetta
21
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 6th Jun 2003 12:15
hmm thanks

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jun 2003 12:53
Well, if you imagine a simple collision system - say one that could detect a collision between the player, and a level. It would be easy to detect a collision and just simple move the player back to the previous position, in psuedo code:

OPX=PX (Player X position)
OPZ=PZ (Player Z position)
MOVE PLAYER (So PX and PZ have changed)
IF COLLISION(PX,PZ) THEN PX=OPX : PZ=OPZ

Now that's fairly straightforward, but sliding collision works slightly differently. You will have 2 sets of coordinate data, the current and the old - you can cross check to see which axis are affected. Now, this psuedo code would provide sliding collision:

OPX=PX (Player X position)
OPZ=PZ (Player Z position)
MOVE PLAYER (So PX and PZ have changed)
IF COLLISION(PX,OPZ) THEN PX=OPX
IF COLLISION(OPX,PZ) THEN PZ=OPZ

That's not hugely different, you need to check the old positions with the new ones for each axis. There are other methods, like having more advanced collision detection that can calculate the position the player should be in themselves, but this is the bare bones of it. One consideration to avoid the player getting stuck anywhere is to only record the old positions when there is no collision, I won't try and explain that because it might not be relevant, but there's nothing worse than sticky players.


HTH

Van-B

My cats breath smells of cat food.
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 6th Jun 2003 18:34
There's a Glossary in the DB Classic Help File, however, it was removed in the DBP manual for reasons totally unknown to me. In case you don't have it, I've attached the whole glossary to the source button below this post.

"Computers are useless they can only give you answers."

Login to post a reply

Server time is: 2024-11-24 16:28:17
Your offset time is: 2024-11-24 16:28:17