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.

Code Snippets / Sliding Collision Made Easy

Author
Message
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th May 2003 21:32 Edited at: 18th May 2003 23:43
!SLIDING COLLISION FOR CLASSIC AND PROFESSIONAL!


Hello guys, I decided to make life easy and make up a couple of functions for sliding collision. I always hear people asking for help with sliding collision, but I dont think that will be needed anymore.

Now there are two different snippets! One works in pro, and one works in classic. Cheers guys! Here is what I ran this on,,,

System Specs:
Pentium 3
512 Ram
GeForce 2

With a sync rate of 80 I was running at a solid 90 FPS in pro, and a solid 83 in classic

Here is the collision code for PROFESSIONAL




Code should work as pasted in pro.

Here is the code for classic




Both those you should be able to paste right in and have work.

Hope you people get some use out of this. This was just made in a few minutes, not a final version at all. Probably wont even keep it........ But anyways I hope you like it!

EDIT: The first time I pasted I messed up,,,,it doesnt work in the SOURCE box,,,Ill post again. The code in the code snippet part should work though,,works for me when I copy and paste.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th May 2003 21:37 Edited at: 18th May 2003 23:43
Here it is in the SOURCE box for Professional Collsion.

Cheers

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
ClearCoder
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 18th May 2003 22:06
i hear it alot but what is sliding collision i know the built in collision i know maths but i don't know sliding collision does it effect the speed like the built in does

Newbie Now; Expert Later
Current project:The Sorus
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th May 2003 22:21
With built in collision, the object simply STOPS when it collides. With sliding collision, the object SLIDES along the other object. Put it this way, if you are walking horizontal to a wall, and your arm brushes up against it, do you stop or keep going?

This is the difference between built in and sliding collision. With built in, you STOP when your arm brushes the wall. With sliding collision, its more like real life, and you keep on going.

Test it out if you have pro patch 4 (I think its less accurate in the demo) If you have classic and you get the code working (its a function defining error) please post the source here! I would like as many people as possible to benefit from this snippet.

I would like to credit Phaelax for inspiring me here. I was at the dark basic codebase and saw his sliding collision. This is where I found out there was Object Size I used the movement from his source, but thats just because I was in a rush.

Cheers,
RPGamer

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th May 2003 23:39 Edited at: 18th May 2003 23:44
This is the Classic collision in the source box...

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
RossageSausage
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 19th May 2003 02:35
Hey rpg gamer

Do you know how to make sliding collision for a .3ds landscape? I am inputing what I think is sliding collision and I finally got dbenhanced to recognize that my player (currently a cylinder)
is colliding with it but I cant move the player all the sudden. I can send you the source with some media if youre interested, otherwise have a great day and thanx for this snippet

RossageSausage

John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 19th May 2003 03:26
For landscapes you need to 'drape' a matrix of the object. This is a great site for DB stuff, and this is the link for their DLL to drape your matrix over your .x or .3ds object....



I hope that helps you out!

Cheers!

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
RossageSausage
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 19th May 2003 07:40
Thanx for the help RPG gamer.....is that dll for dbpro or can it be used with dbenhanced?? I have dbenhanced and soon plan on getting pro but until now my only toy is DBE

Thanx
RossageSausage

John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 19th May 2003 15:05
Can be used with everything I think. Made for classic (and enhanced) but it has been ported to pro. Check out their web forums for help

http://www.nuclearglory.com/developer/db/kdll.html

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
ClearCoder
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 20th May 2003 00:52
okay RPGamer the code work but could you go in to more detail to explain it (the classic version plz) thx

Newbie Now; Expert Later
Current project:The Sorus
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 20th May 2003 03:37
What part do you need explained.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 20th May 2003 03:44
Eh, Ill just explain it all. I usually like people to figure it out for themselves but I am in a gererous mood lately

This is the explanation for CLASSIC code. Its basically the same for pro, only emmitting the CLASSIC parts.




Hope that helps.... Im only explaining because I want the community to get better at coding, which I believe can be helped through example.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
ClearCoder
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 21st May 2003 23:35
using the help files and your explaination i think i get i might use it as the character collision bu i will definaty use it for the camera collision

Newbie Now; Expert Later
Current project:The Sorus
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 21st May 2003 23:47
Hey, howz about collision for when your at an angle to a wall, and with any object rotation ? You'd probably want planes for that.

cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 21st May 2003 23:59
Hamish! You! Be quiet! I am making some amendments later (better camera and stuff, updating the function)

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 22nd May 2003 00:23
OK

cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
aprilfan
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 25th Jun 2003 02:58
I love it!!!! Thanks RPGamer!!! This has fixed my problem!

The Great Schism.- The Earths reaction to Heavons invasion.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 25th Jun 2003 04:33
this is obselete with patch 5 DBP users and some video cards around the geforce 2 just dont tolerate statics in classic.

Its not a total solution for all pc users.

3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 30th Jun 2003 17:11
Moderator. Here's you a question that I been thinking for a long time in this newest project of mine: I have car model, wich the 3d animator of the project sent to me and I'm trying to make it follow the ground. With "get ground height" command I got the car to stay ON the ground but how to make it xrotate like it would look like the car is traveling on the ground. Right now I'm working with matrix, but later with bsp or x file when the 3d animator manages to finish the track model. Can you help me?

3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 30th Jun 2003 17:14
Sorry... The question was for Rpgamer. Moderator... Damn I'm dumb
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 1st Jul 2003 07:58
dont sweat it.

the classic tank example game provided with most distros of DBC DBP has a method for this.

3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 1st Jul 2003 13:29
I don't have the tank example. I tried to get it from darkbasic.com but no source was included. How can I get this soft?

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 1st Jul 2003 13:35
Or could you explane me how to do it? I think the tank source isin't availeble anymore

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 1st Jul 2003 14:21
I can post the tank source for you! I never had a look at it, but I think you will have to make 4 cubes, attach them to the weels of the car and get the ground height for every cube, so that every wheel moves independetly



By the way it is Tank 2

Lets make free games!
Download them at www.fishsoft.tk
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 3rd Jul 2003 16:45
You are number one! Thanx alot. Im at my vacation cabin right now and writing wtih librarys computer so I can
t test the thing right now. So let me ask you a question: Could it be this code taht makes the object rotate with the angle of the ground:

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 11th Jul 2003 01:20
Ok. I'm back home and i got it working. Thanx to "indi" and "FiShFuN4eVeR "

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 11th Jul 2003 21:27
To RP GAMER
"For landscapes you need to 'drape' a matrix of the object."
Does this mean that the dll makes a matrix. Just asking 'cause I'm making a racing game and I have now finished the engine on matrix (Xrotates in the ground) so could I just use the dll to make matrix that is just like the map object and then use the same source?
PLEASE ANSWER

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 12th Jul 2003 01:06
This plugin takes the height data from your .x object and molds a matrix to its shape. This way, you can have matrix commands on a 3D Object. It just saves you the time of making the matrix and adjusting to all the height data.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 13th Jul 2003 13:41
Great. Only one thing, I downloaded the plugin and didn't understand a bit.
Quess I have to do it some other way

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
3dZmaster
20
Years of Service
User Offline
Joined: 30th Jun 2003
Location: Finland
Posted: 13th Jul 2003 16:41
Could you tell me what to do with the plugin. How can I use it. Lets say I have an x object and I want the plugin to make matrix to it. How can I do this?

Current project: Dodge Viper Car Game (Not named yet) Other car models are going to be included soon
Jonny_S
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 13th Jul 2003 16:44
This is excellent code, you dont realise how much you've helped me

The man with no sig
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Jul 2003 17:42
sMs: Cheers

3DZ: Try checking out their website - the forums seem to offer a lot of support.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 13th Jul 2003 19:02
I suppose the matrix draping doesn't work on a landscape with tunnels and holes. I currently have sliding collision for ellipsoids on any mesh, but sometimes it can get shocky a bit.
Hmm, I could of course use the curvevalue .

Kevil

John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 15th Jul 2003 04:12
Yea Kevil it probably doesnt. I guess its always worth trying, The example screenshot I saw had a raised highway with a space underneath it,,,I think Maybe Im thinking of the wrong shot but if thats the case it may work

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 12th Aug 2003 07:00
i got this code Archoni. if fixed alot of problems i was having with collision. but now i found a bug and hoping there is a fix for it. when i push up and down towards a wall it jump though it.. it might be how i have the code set up. i noticed it only on the left and bottom wall.


when i unrem Collbox(12) it puts a invisable wall in the middle. and Collbox(14) makes the collision not work on the side walls..


thanks for any help with this..
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 12th Aug 2003 16:28
well i got most of the it worked out but i still can make it jump thought objects i am probally not going to be using side step in my game so i don't need to worry about it..
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 14th Aug 2003 16:54
RPGamer: I'm new to collision (I always use the CShop .col export method) and I'm just wondering if it's at all possible to make this work for curved surfaces. I have a .x of a track with curved sides, how would you get it to work?

The only other object collision method I've found which are build in and work with just an .x file (ie. no collision boxes) is the automatic object collision. Any ideas?

You are the th person to view this signature.
GRAVITY: I fought the law but the law won
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 14th Aug 2003 22:36
(never thought Id be assisting david ) If you want to use a .x object for collision, like a track your talking about, Id suggest 'draping' a matrix over it. Find the object height and raise the matrix points to append to the model, I posted a link a litte ways up the page.

RPGamer

Current Project: Eternal Destiny
Porting all files to my new computer
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Aug 2003 00:14
Quote: "never thought Id be assisting david "


Wow, really? Thank a lot for the praise! Am I really seen like that? Wow.

Back on the subject, I'll have a look. It never occurred to me that I could use intersect object to drap a matrix over a .x - I'll have a try

You are the th person to view this signature.
GRAVITY: I fought the law but the law won
Mattman
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 22nd Aug 2003 03:14
Sticky?

Got a knack for finding secrets??? Jingot Racing --- A new brand of Racing --- Only from Nightwatch Studios
Ocean Runner
20
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 23rd Aug 2003 04:49
Heresimple sliding collision for DBC:


"Computers in the future may weigh no more then
1.5 tons.
- Popular Mechanics, 1949
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 23rd Aug 2003 06:16
enable static occlusion isnt in DBP right.
I think this was throwing me about the box collision
my bad about adive before.

http://www.lunarpixel.com
It's already tomorrow in Australia

Login to post a reply

Server time is: 2024-04-26 21:36:37
Your offset time is: 2024-04-26 21:36:37