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.

Author
Message
zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 3rd Aug 2007 21:46
Oki if i really whant to finish my game, and whant to understand darkbasic pro, i should really learn about collision... problem is that i know the commands, just can't use them.. lets say i have 2 objects, 1 and 2.. i have the code


Everythign fine till now.. Now do if have to do the collision box? Its oki but i do not understand whats is with the coordinates, x1 and x2, y1 y2 etc? Why are they there? Please guys, explain them to me, and help me understand collision

vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 4th Aug 2007 00:43
Get a physics dll like Dark Physics ($$$) or Newton (Free).


Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 4th Aug 2007 01:59
I've never used collision boxes. If they are just boxes then you can just use something like this.



Things get more complicated when it's not boxes. Vorconan has mentioned two possibilities, but there is also Sparky's dll (free).

Windsept
18
Years of Service
User Offline
Joined: 9th Jun 2006
Location: United States
Posted: 4th Aug 2007 16:58
Yeah I agree with Daemon get sparky's dll as he said it is free and it comes with examples so you can build your own collision system or use the ones in the examples .

But like vorconan said get a physics system and all you have to do is basically say "physics on this object" and your done. There are a few other complications but all the math and vectors are calculated by the dll making life simpler for you.

Windsept
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 5th Aug 2007 02:18
If you need an example, I just perfected the collisions in this. It uses Sparky's (free). You can find the commands easily, everything that starts with SC_ or sc_.



I didn't include the media. But what it does is creates a collision sphere around your object and checks if it's hitting a wall based on the position before and after movement. Just look in the loop to see what I mean. Everything else is in the function, slidingcollision.

When you hit a wall, you stay there, and you can slide along it by turning and pressing forwards. Hence slidingcollision.

And you need the Sparky's DLL. Forum search it. And leave the delete memblock 1 command there, sparky's needs it to work.

Here's a quick overview of the function:
Radius#= The radius of the collision sphere.
Dyn= Your player object
Obj= Your environment object.

Just call the function in your loop like I did. And have your program record the old and new X,Y, and Z position of your player, like above. Hope it helps.
vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 5th Aug 2007 02:37
Here's a dark physics example, a ball falling onto a box, you can also change it's material to make it fall like a rubber ball, or fall like an iron ball.




culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 5th Aug 2007 05:11
Since he mentioned DP, I thought I'd give you a DP example I made a while ago too.

It's a ball that falls onto a cloth and tears through it. Looks pretty cool too.



No media, just compile. Hope it helps if you ever need it for some obscure reason.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 5th Aug 2007 23:14
Okay. Make object collision box is a simple command. x1 is how far outwards the collision box goes to one side. x2 is how far outwards it goes to the other side. The same goes for the y and z versions of this. Using a negative number on the X axis will make the box go outwards LEFT. Positive will make it go RIGHT. On the Y axis, negative goes DOWN and positive UP. On the Z axis negative goes BACKWARDS and positive goes FORWARDS.

Say you had a 10x10x10 cube. (Make object cube 1,20)

The collision box for this would go as follows. I believe a 0 goes at the end to say it's NOT a rotating collision box.

Make Object Collision Box 1,-10,-10,-10,10,10,10,0

Let me know if you have any questions

Login to post a reply

Server time is: 2024-09-27 02:27:21
Your offset time is: 2024-09-27 02:27:21