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 / Slilding Collision on imported model

Author
Message
roddman
17
Years of Service
User Offline
Joined: 24th Jul 2007
Location: Over There
Posted: 10th Aug 2007 19:17
Ok i'm working on a simple FPS game and I've made a small level and imported it into DBC just to test everything out (Walls, Ramps, and a Floor). Anyway I was wondering if there was any way to return Sliding Collision data from an imported .X or .3ds model.

I tried using Get Object Collision X() / Y() / Z() but they all returned zero, I was wondering if anyone knew a way to detect for sliding collision without using the Make Object Collision Box command a couple of hundred times.

I would appreciate any ideas, thanks.

Cory
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Aug 2007 22:34 Edited at: 10th Aug 2007 22:43
Hello,

What are you trying to do with the collision results? Maybe there is an alternative that will produce the effect you are looking for.

For example, if you know the position of a particular object, you could use the Object Size x y or z functions to get the extremes. From the extremes you can match the position of the player object and program your own collision response.

If the player object is on a ramp and you want a gravity effect, you could have 4 or more invisible objects that are N S E W of the player and slightly above the floor. If the slope of the floor changes enough in a particular direction based on which direction the player is facing and an invisible object is colliding with it (the floor that is), then make the character slide in the opposite direction. For this same kind of thing, eliminate the sensor objects and instead record the players current position, and after they move compare that position to their new position. If Y changes a certain amount, you know the slope has changed and you can program the character's movement accordingly (though the trigger is moving the character for the comparison).

Enjoy your day.
roddman
17
Years of Service
User Offline
Joined: 24th Jul 2007
Location: Over There
Posted: 11th Aug 2007 18:07
@Latch
Thanks for the advice i'm going to try the invisible sensor object idea, and hopefully I can get it working

Thanks

Cory
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Aug 2007 19:58 Edited at: 11th Aug 2007 19:59
look at the "tank" demo in the dbc myproj folder, it uses invisible sensors

Your signature has been erased by a mod because it was rubbish.
roddman
17
Years of Service
User Offline
Joined: 24th Jul 2007
Location: Over There
Posted: 12th Aug 2007 22:02 Edited at: 12th Aug 2007 22:04
I've got the collision system working pretty well I'm posting the source code here and the test map along with it. Take a look and tell me what you think and where I can make some improvements.

The map is just a test map and is kind of hard to see but you get the idea, a few ramps and a couple walls. I'm working on fixing the glitch that allows the player to climb the walls

Ramps work good
Gravity works good
Collision detection is good
Player can climb walls?

@ Latch
I used the sensor idea to detect a ramp, thanks.

@ Obese
I forgot about the example files in the myproj folder, I modified the collision system from the Room.dba file to use gravity and detect on the Y axis too, thanks for the tip.

I used as many rem's as I could but the code is still sort of confusing, I appreciate any feedback



[Edit] Sorry, I forgot to say that you can download the map via the download link just put it in the same folder as the .dba

Cory

Attachments

Login to view attachments
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 12th Aug 2007 22:19
Search collision... click the "Massive Collision Resource" thread... click the "Sliding Collision Function Using Sparky's Dll" link... copy function into program, call function, feel all warm inside knowing collision has been taken care of .


Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Aug 2007 05:21
@047
Quote: "Sorry, I forgot to say that you can download the map "

It was blanched out and I couldn't see any detail so I switched it to wire frame mode.

If you have DBC enhanced, take a look at Sparky's DLL like Ruccus suggested. The more object's you have to check for collision, the better the performance of the DLL compared to the inherent DBC commands.

Otherwise,
Quote: "Player can climb walls?"

Check for a change in x and z as well as y. If x and/or z change you can assume that there is forward or lateral movement in which case you could be on a slope if y is changing also.

If Y is only changing and x and z are not (because there is a 90 degree surface in their path) you can assume you are over a cliff or against a wall. In this case, check for a change in y greater than a certain value. Let's pretend there are stairs, and on average a stair height will be y=4. If you come across a change in y above 4, then maybe it's something too high to climb over (this based on the premise that x and z aren't changing as they would on a slope)

Enjoy your day.
roddman
17
Years of Service
User Offline
Joined: 24th Jul 2007
Location: Over There
Posted: 13th Aug 2007 17:00
Quote: "It was blanched out and I couldn't see any detai"


I know, I just threw that map together in about 5 minutes. I just wanted to demonstrate how the player (camera) could move up ramps, etc. I might work on making a textured one

Quote: "feel all warm inside knowing collision has been taken care of "


I'll probably have to switch to Sparky's when I add enemies and allys to a game, to improve speed but I just wanted to see If I could get collision to work on an imported model. Thanks for the feedback

Cory

Login to post a reply

Server time is: 2025-05-30 13:38:52
Your offset time is: 2025-05-30 13:38:52