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.

DarkBASIC Discussion / need help with 3d collision

Author
Message
luke810
19
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 5th Sep 2006 01:02
I am making a third person game and I need help on how to do object collision with non-square objects. Please help!
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Sep 2006 21:22
Please be more specific. What are you trying to do? Do you have any example code?

Enjoy your day.
luke810
19
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 6th Sep 2006 05:30
Here's the code from a sliding collision example i tried to edit and another where i tried a custom collision engine with to many glitches:
luke810
19
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 7th Sep 2006 00:18
I'm trying to make a third person platform style game modeled after ratchet and clank the ps2 game but I can't get a good collision engine without any major glitches.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 7th Sep 2006 06:24
Take a look at the dll that's contained in this link. The examples included may help you. It projects rays and tests for points of intersection.

http://forum.thegamecreators.com/?m=forum_view&t=31051&b=5

As far as collision on non-square objects, it depends on how precise you want the collision. The more precise, the more taxing on the cpu.

The commands:

SET OBJECT COLLISION TO BOXES
SET OBJECT COLLISION TO SPHERES
SET OBJECT COLLISION TO POLYGONS

are ordered here in terms of precision. In general, you use these commands on objects that are going to move or change - like the player or monster objects, or maybe health packs. But sometimes you would use MAKE OBJECT COLLISION BOX if you want to use the return values GET OBJECT COLLISION X() y or z .

For stationary objects, like walls, platforms, or maybe the ceiling, MAKE OBJECT COLLISION BOX or MAKE STATIC COLLISION BOX.

Be sure that you know the dimensions of what you are encasing inside the collision box. I've had the most success when the collision box is made just a little bit bigger than the wall or crate I'm putting the box around. Also I found that you should make the dimensions from a lesser value to a higher value. So if you are making a 5x5x5 cube shaped collision box, the code might look like MAKE STATIC COLLISION BOX -1,-1,-1,6,6,6 (I like to make it just a little bigger).

You could also make your own collision routine. Basically, it is just math that checks the distances between points. Since Every Object in DBC's 3d world has positional coordinates, you can measure the distance between them and set limits for what distance constitutes collision. A simple way to think of it would be to check if the distance is <= the sum of the two colliding objects radii. That's very bare bones, but it should give you an idea.

The example you were trying to modify, is a very good example. I believe that's example 25 or something. You just have to really pick it apart. Basically what it does is put static boxes around the walls and floor, 5 different ones - it makes collision boxes around the pedestals, and one around the player. Then it checks the collision status and changes the players position so that it does not pass through anything indicated as collidable.

Enjoy your day.
luke810
19
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 7th Sep 2006 15:46
Thx for the link it was a really good collision engine and worked great!

Login to post a reply

Server time is: 2026-07-07 18:20:40
Your offset time is: 2026-07-07 18:20:40