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 Professional Discussion / The secret of collision

Author
Message
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 28th Sep 2003 05:20 Edited at: 11th Nov 2003 21:46
Ok,
I have a sphere that you can rotate right that moves forward on a square w/ a hole in the middle (a square track).

The track is made out of 6 3D boxes but the collision works very poorly.

To fall off the track you need to be VERY far off the track and then it detects the nega-collision.

I set collision to spheres for the sphere...and to boxes for the boxes.

I want it so that if you go off a little bit you move down so the sphere is always touching the box and if it cant it should fall off.

Like so:
IMAGE REMOVED

not:
IMAGE REMOVED


All help would be greatly appreciated


I wanted to learn C++ but then I started having nightmares.
I would scream at night, "AHHHHH!!! THE SEMI-COLONS"
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 28th Sep 2003 05:40
you try polygon collision?


Dark Basic Pro has arived! I can feel the power!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 28th Sep 2003 05:50 Edited at: 28th Sep 2003 05:50
No,
I will try that.

I hear its a little buggy though...

The rock has rolled!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 28th Sep 2003 06:09
well, unless a polygon edge collides with a polygon edge, it wont register a collision (in Dark Basic Pro anyways)


Dark Basic Pro has arived! I can feel the power!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 28th Sep 2003 20:40
Ok,
I'm still messing around w/ the pollygon collision...
But whats the "set collision to spheres" command for?

The rock has rolled!
UberTuba
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 28th Sep 2003 20:58
setting the collision to spheres

the artist formally known as darkfluff
Yian
23
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 28th Sep 2003 21:51


-john D.
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 28th Sep 2003 23:35
Can someone make a collision reutine where theres a box and you can move left and right and if you go off a bit you go down a bit and if you come back you go back up??

Please!


I've tried EVERYTHING!!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 29th Sep 2003 01:39
Please?

The rock has rolled!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 29th Sep 2003 01:55
I've developed one before, let me get it...


Dark Basic Pro has arived! I can feel the power!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 29th Sep 2003 01:57 Edited at: 29th Sep 2003 01:58
Here it is:



PS: If you want to use it, you might need to replace the objects loaded with what you need. It basically checks if an object is colliding with a certain object. If it is, push the one object up until it isnt colliding anymore.


Dark Basic Pro has arived! I can feel the power!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 29th Sep 2003 01:58
Thanks!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 29th Sep 2003 02:24
Umm..That doesnt work

Can you just make a little snippet w/ a 20,10,50 box and a size 30 sphere and you press left and the sphere moves left...and it goes down a little if it goes partially off the edge and fall if its not touching anything.


Thanks

The rock has rolled!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 29th Sep 2003 03:53
Here is some simple code that demonstrates your problem but I don't know how to solve it! Setting collision to polygons for the sphere creates an interesting effect!



If your mansion house needs haunting, just call Rentaghost!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 29th Sep 2003 14:27
oh, sorry about the code, it was just a quick copy and paste of an engine I've been working on over the weekend. Sorry.


Dark Basic Pro has arived! I can feel the power!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 29th Sep 2003 23:07
In spooky's code, even when you "set object collision to polygons" or spheres, the little box is still around the sphere.

WHAT'S THE DIFFERENCE BETWEEN BOX AND SPHERE COLLISION?

The rock has rolled!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 30th Sep 2003 00:03
box creates a 3D box around an object, and if the target object is within the box, the collision has registered. Same goes for spheres except, it uses spheres.


Dark Basic Pro has arived! I can feel the power!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 30th Sep 2003 04:50
But it doesn't!!

The rock has rolled!
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 30th Sep 2003 05:11
well, it wont show the spheres, and it wraps a new sphere (or cube) around every limb of the object, and scales and rotates it so that its gets a tight around the object as possible.


Dark Basic Pro has arived! I can feel the power!
Yian
23
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 30th Sep 2003 17:35
i wonder...could this be considered a bug?

-john D.
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 30th Sep 2003 18:46
No. It's been like this since Classic. Frankly collision this good is in very few games and it's rarely needed.

...still a very desirable feature however...

--Mouse: Famous (Avatarless) Fighting Furball
Read It: http://www.angryflower.com/itsits.gif
Learn It: http://www.angryflower.com/bobsqu.gif
Yian
23
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 30th Sep 2003 22:06
well considering dark basic products are in a way C++ engines,it would be possible to include perfect collision in a future patch...Rich?

-john D.
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 1st Oct 2003 00:53
This is really annoying }:- (

I'm going to write my own collision!!!

Thank you for your time!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 1st Oct 2003 05:34 Edited at: 1st Oct 2003 05:35
Umm,
How would I go about writing my own collision between a size 30 sphere and a size 20,10,50 box so that it works like stated above?
would I have to get how many pixels on the x axis that are in each row.

The boxes don't move so I think this would make it easier.

All help would be greatly appreciated

The rock has rolled!
Sonic
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: UK
Posted: 2nd Oct 2003 06:17
Hmmm for the 3rd time in 5 mins ...
http://www.nuclearglory.com/developer/db/kdll.html

Hint: Be sure and enter your addy to get news of updates!

"My ignorance amuses me..."
Guyon
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location: United States
Posted: 2nd Oct 2003 07:18
Wik,
Spooky always has the best examples for collision. Ease to understand nice controls. Watch and learn form him.

He put the box around the sphere so you could see it. If you don' want to see it just rem this line:
rem show object bounds 2
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 2nd Oct 2003 13:06
Guyon, Wik knows he can tuen off showing the object bounds.

What I found is you cant do collision between a sphere and a box because the sphere always uses box collision.

What is annoying is that collisions between two spheres correctly use spherical collision. Try this:



If your mansion house needs haunting, just call Rentaghost!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 3rd Oct 2003 00:49 Edited at: 3rd Oct 2003 00:50
That gave me an idea!

If it works I'll tell you what it is...


[EDIT]And if that doesnt work...I'll try the kdll

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 3rd Oct 2003 23:35
Ok,
My idea was impractical.

I'll try Kdll now, although I'm not good with DLLs

BTW @sonic
I already knew about the Kdll, I was just looking at it before I read your post

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 4th Oct 2003 04:51
That Dll is great and all..
But can you use it w/ primitives?

The rock has rolled!
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 4th Oct 2003 06:28
You should be able to.

If you look at the LoadCollisionObject(FileName$) function, you'll notice that it uses the make mesh from object function on the loaded external model. Then it makes a memblock from that mesh and uses it for collision.

So, just use the make mesh from object function on your primitive instead, etc... then it should work fine.
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 4th Oct 2003 19:09
Oh.
Thanks for the help!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 4th Oct 2003 20:02 Edited at: 11th Nov 2003 21:48
OK,
I have all of the Dll stuff configured, but now it does something really strange.

I made a lite version that you can download, it shows the problem.

REMOVED
The ball is supposed to go around the track (made of 6 boxes) and if you go off the track you are supposed to die. I have it so when the ball's position is <-5 it does the losing sequence (not included).

For some reason, once the ball hits the track it ends. (even w/the losing sequence included) Also, if you rem out

if object position y(600)<-5 then exit

it still (freezes)

All help would be greatly appreciated


I wanted to learn C++ but then I started having nightmares.
I would scream at night, "AHHHHH!!! THE SEMI-COLONS"
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 5th Oct 2003 03:52
Here's the code if you just want to look at that:




The rock has rolled!
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 5th Oct 2003 06:00
Greets,

After isolating the source of the problem, I found it was exiting when it created the second box object.

It was crashing at the point where the second mesh pointer was sent to the DLL. After doing some more testing, I realized that the DLL seems to exit the program if more than one collision mesh is passed to it.

I believe most of the users have been using a single mesh for their world.

In any case, I apologize for the trouble. The new collision DLL that is coming out is designed specifically to handle multiple moving objects all using various kinds of collision. I'll be testing it directly with DBPro and I will also test it with the DBPro primitives to make sure that it works properly.

The new collision system is due to release within the next 7 days.
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 5th Oct 2003 06:10
Thanks for looking at that code!

Is it possible to turn my 6 boxes into one object?

If not, I'll just have to wait a week

The rock has rolled!
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 5th Oct 2003 15:38
I don't know of any "easy" way to do that. And if I tried, it probably wouldn't be very stable as I don't have a whole lot of time to debug it.

I just recommend to wait for the new collision system.
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 5th Oct 2003 17:39
Ok.

Thanks to all who replied!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 5th Oct 2003 18:05
I was just searching the codebase and found that there is a x exporter so in my editor I made for making the tracks I'll save it as an x instead of an array!

I'm happy now!

The rock has rolled!
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 5th Oct 2003 23:45
It still doesn't work
I converted the tracky thing into one model but it still does the same thing!!!



Code:



If anyone needs the X to debug I'll upload it.

The rock has rolled!
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 6th Oct 2003 02:58
Yes, that would be good. Please provide a download of the x file and the main program you're running. Or is that snipplet the entire program? Will it run with the media from the "Lite" package you uploaded earlier?

Thanks
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 6th Oct 2003 03:00 Edited at: 11th Nov 2003 21:48
yes,
you need the "lite" media.

The X is here:

REMOVED


And that snippet is just the main loop without all the "fancy" things


I wanted to learn C++ but then I started having nightmares.
I would scream at night, "AHHHHH!!! THE SEMI-COLONS"
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 6th Oct 2003 05:04 Edited at: 6th Oct 2003 05:06
Ok, here's the fixed code. The problem was that you were calling the collision object function a second time for object 600 (the sphere)

I fixed the code so collision works properly.

Also, I commented out the part where it exits, just so I could test.

NOTE: It includes the fancy stuff, for a little better cleanup of memory.

Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 6th Oct 2003 05:06
Thank you VERY much

P.S. That was a very fast reply

The rock has rolled!
John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 6th Oct 2003 05:16
Oi there is a DBP Command that will take objects next to each other and make them into one...only I forget what its called. Its mainly for making walls out of a whole bunch of boxes and getting rid of the 4 polies that arent being used with two boxes next to each other.

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - [email protected]
Aith
23
Years of Service
User Offline
Joined: 21st Oct 2002
Location:
Posted: 6th Oct 2003 07:20
Hmm... I was going to suggest the SET OBJECT RADIUS command, to see if that would help.

Glad to see it's working for you, Wik. Happy coding.
bruceatk
22
Years of Service
User Offline
Joined: 25th Aug 2003
Location: Loudon, NH
Posted: 6th Oct 2003 07:43 Edited at: 6th Oct 2003 07:45
I took spooky's first example and played with adjusting the object radius when near the edge. It seems that this could be made to work with the correct radius to position mapping.

*** Update I see that Aith and I had the same thought process

Bruce
Yuri
23
Years of Service
User Offline
Joined: 12th Jun 2003
Location: Italy
Posted: 6th Oct 2003 18:02
Please try this... is the original Spooky code a little changed:



however this is not a perfect collision...

http://www.cbmzone.com - CBMZone main administrator
http://www.cbmsoft.com - CbM Soft main administrator
Wik
23
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 7th Oct 2003 00:27
Yes,
Thats pretty good, but I like the dll collision!

The rock has rolled!

Login to post a reply

Server time is: 2026-07-25 07:01:51
Your offset time is: 2026-07-25 07:01:51