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.

3 Dimensional Chat / Need Sliding collision help

Author
Message
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Sep 2003 00:44
Ok, I understand how to check if objects are intersecting, but how can I make collision that doesn't make them "stick" together?

NOTE: I am using a cylinder for the moving object and a box for object being hit.

~PlystirE~
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 13th Sep 2003 00:55
AUTOMATIC collision will back-track your object
look in the help under collision commands

-RUST-
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Sep 2003 01:24
The collision commands only tell me if the objects are colliding. I already know that. And I can already back track it, but that doesn't give me sliding collision.

~PlystirE~
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 13th Sep 2003 02:08
I was thinking of BSP collision, sorry


-RUST-
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Sep 2003 02:58
Well, you need to keep track of the last position of the object, and use that to move the object back. It has to be independent though, like X and Z would have to be checked seperately.

In psuedo code.

old_objx#=objx#
old_objz#=objz#
*Move the object, updating objx# and objz#
if collision(objx#,objz#)=1
if collision(old_objx#,objz#)=1 then objz#=old_objz#
if collision(objx#,old_objz#)=1 then objx#=old_objx#
endif

That's it, might not be ideal for built in collision, I suggest making a function that moves the cylinder to the specified positions and returns a 1 if the object is colliding.


Van-B

My cats breath smells of cat food.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Sep 2003 03:38
Here's some code that demonstrates howto do sliding collision using dbpro's built in commands. Unfortunately it is no good if any of the objects in your world are rotated, although setting a flag of 1 on make collision box command 'should' allow this but it dont work too well. To see this code in action see 'return to phobos' game in 20 line challenge. It is a doom type game with really good sliding collision, with steps and all sorts!



If your mansion house needs haunting, just call Rentaghost!
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Sep 2003 04:25
hmmmm, is there perhaps someone who could show me a way of doing this wihtout the built in collision comands?

If I must learn something I'd rather learn how the commands work (and why, i suppose)

~PlystirE~
Plystire
22
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Sep 2003 09:17
Hmmm, I looked through the code and realised that most of those commands I had no idea even existed (teach me to read the manual, huh?)

Well I put it in and altered it to fit my code, but it gives me the double image effect :-\ where the moving box is on top of the colliding box and then under it, then back on top, etc. And it has no collision with the sides! it only has collision with top and bottom it seems. Maybe.......is this code only supposed to work with cubes? because I need it to work with variable boxes.

~PlystirE~
Guyon
22
Years of Service
User Offline
Joined: 6th Jun 2003
Location: United States
Posted: 15th Sep 2003 15:53
spooky,

What a really nice example you made! You should post it under the Code Snippets section.

Login to post a reply

Server time is: 2025-06-26 17:51:42
Your offset time is: 2025-06-26 17:51:42