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.

Work in Progress / COLD - Sliding Collision for Polygonal .x models/objects/maps

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 29th Jun 2005 02:19 Edited at: 1st Jul 2005 03:04
COLD
Polygonal Collision Detection System [DBP]

Download COLD v1 Below
http://www.ruccus.net/COLD.rar - 5.61 MB
http://www.ruccus.net/COLD.zip - 8.71 MB

I’ve been trying to come up with a way to achieve polygonal collision responses and the feel of sliding collision found in many professional games these days much like Kensupens or G-Man and Lost in Thought's Collision Systems. I wouldve just used theirs but I couldnt understand all of the code and I like making my own code from the ground up. Here's the specs so far:

COLD Features:

Polygonal Collision Detection
Customizable Collision Responses
Built-In Sliding and Sticky collision
Lag Reduction Process
Collision Support for .x and .dbo objects
Automatic Ramp and Hill collision handling


COLD Explanation/Syntax







How COLD works:

Basically the user has collision "paddles" or limbs in this case, 6 of them, positioned on each main face of the user. An intersection ray is sent from the limbs to the user to detect when two polygons of an object cross eachother. When the intersection occurs, since the limbs are positioned so close to the user, if the intersection is anything greater than 0 COLD handles appropriately.

I never could grasp how people got the newvalue commands to give sliding collision so this is my attempt at it, but incase anyone wants to edit the way the collision works out just set the response value to 0 and nothing will happen but the intersection will still be detected and recorded in variables.

So far I've tested the system against both .x and .dbo files, Im working on testing it with .3DS. The system seems to work fine for all of the maps I've created but please note:

!! NO OBJECTS CAN BE INTERSECTING EACH OTHER !!

When any objects are intersecting eachother (or "crossing") the system gets confused and moves the user wrongly. Its a bug that may be fixed in later versions of the code.

Customization Process:

If the COLD responses dont suit your needs then here's how you can customize it to fit what you want.

COLD fills several global variables with data about the collisions, here are the variables and what they mean:

COLDfront#
- The user is colliding with something infront of them
COLDback#
- The user is colliding with something behind of them
COLDleft#
- The user is colliding with something to the left of them
COLDright#
- The user is colliding with something to the right of them
COLDtop#
- The user is colliding with something above of them
COLDbottom#
- The user is colliding with something below of them
COLDobj#
- The current object being collided with

Applying COLD to your program

COLD is put neatly into easy-to-use functions so applying it is simple. Just follow these steps:

Step 1:
Include the COLD.dba source file in your project that contains the COLD collision code.

- Open up dbp and find your project
- Once your project is open, select the "File" button to the bottom right of the screen
- Select "Browse" from the top
- Locate the COLD.dba file and select it

Step 2:
Load COLD's limbs (outside of the loop)



I recommend setting the X, Y and Z values to the user's X, Y and Z values divided by two. Experiment until the collision works best for your object. Make sure the x y and z values are all positive, the system works out which ones to turn negative.

Step 3:
Update COLD's variables for later use (inside loop)



This function only has 3 variables in it right now but as time progresses it will contain more

Step 4:
Call the main COLD command (inside loop at end)



And thats it! COLD should now be set up and able to be run with the simple function calls.

Future plans for COLD:

- Changing the limbs from cubes to small plains (for some reason I cant get this o.O even when I use "make object plain" instead of cube )
- Adding Bouncing Collision (for games like pong or pin-ball)

C/C is encouraged. The more comments and critisizm I get the better I can fix the code to work for everyone. Also, you can post any customized collision responses you've made here and Ill add them to the main post as a resource for newcommers. Please report any bugs you find along with a screen shot if possible so I can best see what's happening. The code is pretty simple so many should be able to understand it and edit it to their needs.

NOTE: COLD currently only works for one object colliding with another, so right now its ideal for solo games where youre just paying attention to your character colliding with objects, Im working on making COLD work for multiple objects colliding.

Download COLD v1 Below
http://www.ruccus.net/COLD.rar - 5.61 MB
http://www.ruccus.net/COLD.zip - 8.71 MB

Hope it helps!
- RUCCUS


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th Jun 2005 14:44
Quote: "More than 100 views and not a single reply "


maybe that's cuz we're all using nuclear glory
im downloading your program and will try it out

when you hit the walls, it doesnt look good at all when you go back and forth (vibrate) against it. ngc and kensupen (havent tried lost in thought's) are much smoother

NGC is faster

the corner acted weird once, i slowly went into corner, then bumped against it

other than that, good job... i dont think i could program a sliding collision engine. it seems very easy to impliment as well, though i am using NGC, i dont need a collision engine

perhaps you should have ellipsoid collision?

also in your testmap there should be an object where there is a ramp and a ceiling, so you can test the y collision when you go up a ramp and into a ceiling (this where NGC fails miserably, though it might have been fixed, im using a very old version)

Check out the DB Freebie Archive: http://lysergium.net/dbfree/ thanks to DARKGuy
Want your game hosted free and a forum for feedback, or want media hosted? Click the email button below
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 30th Jun 2005 15:30
Harsh comparing it to NGC, I use NGC and im still interested.
Sorry about the lack of replies, one thing that puts people off is when it looks like theyve got work to do. Thats what put me off it a first !
I made the same mistake on my first post, plenty of cool bits, but just too much in one go for people to take in.
Well i'll download it later, for now i'll just bump it back to the top
Good luck man.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 30th Jun 2005 20:18 Edited at: 30th Jun 2005 20:19
w00t, replies, time to take that off the top

@qwe: Thanks for the c/c, I understand the collision is a bit jumpy but that can be compensated by either changing the collision speed or changing the collision response to a customized response of yours if you know how to solve sliding collision in another way (maybe with the newvalue commands).

@Baggers: I guess I should've left this in Code Snippets so people didnt get the idea that there's a lot of work left to do. Goodluck with the download though if you have NGC I doubt this will compare.

I realize now I shouldn't have written that dumb statement at the top about the views it was kind of ignorant I just thought people could leave some sort of response after viewing it, its gone now either way.

Thanks for the c/c so far!


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 30th Jun 2005 21:13
Hey thats pretty impressive !...yeah the jumping when it hits a wall should be easy enough to fix.
Keep up the good work man!
Have you tried it with multiple objects yet ?

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 30th Jun 2005 21:46 Edited at: 30th Jun 2005 21:51
Thanks Baggers,

Do you mean using the collision against two objects moving like to players or collision against two maps in one game?

Im pretty sure itd work either way, this is the only problem:

UPDATE_COLD() updates the COLDx, COLDy, and COLDz variables, but these variables are given to the object you specify in UPDATE_COLD(). So, if you wanted to update cold for more than one object, the system would just overwrite the current cx cy and cz variables which means the sticky collision only works for one object. I dont know how to give objects their own variables, maybe using an array of some sort but thats the main bug Im trying to fix.

If anyone out there knows how to give objects their own variables, so like

VARIABLE#.OBJECT 1
VARIABLE#.OBJECT 2

I was thinking something like a for/next loop so:



But since variables can have brackets in them that'd just be recognized as VAR(i)#, Ack, I dunno Ill figure something out.

Id greatly appretiate it. Gona do some searches later on.

P.S: Baggers, mind if I make a model of your rabbit (not jazz the avatar one) and put it in a project being worked on? (gona post a WIP soon)


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 30th Jun 2005 23:43
Well you could but you couldnt sell it as that is 'Max' and already is in a TV series, and a very popular computer game...if you havnt played it yet go buy it now !

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Jul 2005 00:57 Edited at: 1st Jul 2005 03:01
What's an elipsoid btw?


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 1st Jul 2005 04:14
A 3D oval...think of a sphere stretched.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Jul 2005 04:38
Oh, well yeah this works for those...pretty sure...


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection

Login to post a reply

Server time is: 2024-09-29 06:23:27
Your offset time is: 2024-09-29 06:23:27