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.

Newcomers DBPro Corner / Just how do you use Ng's collision system again!!!

Author
Message
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 15th Apr 2004 17:37
I've read through the manual but it all sounds to complicated. Im making a pong game and came across some problems with the built in collision system in dbpro so I thought I would try ng's system. But just what commands do I need to use to do for example:
If object 4 hits object 1 rotate
Thankyou any help would be much appreciated.

*For every problem you come across you gain something from correcting it, I hope.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 16th Apr 2004 08:04 Edited at: 16th Apr 2004 08:06
It's not too bad.

StartCollisionPRO()
StartCollisionDebugPRO()

Define some custom types:

TYPE_ELLIP = 1
TYPE_MESH = 2

Then, are you doing ellip-2-mesh or ellipsoid-to-ellipsoid detection?

For ellipsoid-to-mesh, use the command:

SetCollisionsPRO( TYPE_ELLIP, TYPE_MESH, ELLIP_2_POLY, RESP_STICK, DYN_RESP )

For ellipsoid-to-ellipsoid collision use:

SetCollisionsPRO( TYPE_ELLIP, TYPE_ELLIP, ELLIP_2_POLY, RESP_STICK, DYN_RESP )


Then define which of your objects are meshes and which are ellipsoids. Example:

CollisionTypePRO( pong_ball, TYPE_ELLIP )
CollisionTypePRO( pong_world, TYPE_MESH )


Then move your objects as normal and call RunCollisionPRO() once per main loop.

Then you can detect if you pong ball hit a wall (or paddle) with:



If we made it any simpler the system would lose its dynamic power.

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 16th Apr 2004 12:26
Theres still a few things puzzling me
1.What is the difference between and ellipsoid and a mesh?
2.So does SetCollisionsPRO( TYPE_ELLIP, TYPE_MESH, ELLIP_2_POLY, RESP_STICK, DYN_RESP )mean the object will stop because that is what I understand from the reference manual? If im right where in the source code would I type the detecting for the ball hitting the paddle?
3.Does all the above go before the main loop and what bits would go in the main loop?
Thankyou

*For every problem you come across you gain something from correcting it, I hope.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 16th Apr 2004 12:38 Edited at: 16th Apr 2004 12:40
Quote: "1.What is the difference between and ellipsoid and a mesh?"


An ellipsoid is a deformed spherical shape. It has no vertices or triangles that make up its shape. So it's a perfect ellipsoid.

A mesh is an object made up of triangles/verts.

You would use an ellipsoid for something like the player in a first person shooter. You want the ellipsoid to encompass the player. Then you want the level (a mesh made up of triangles) to be set as the mesh. Then you want the ellipsoid to collide with this mesh, and hence, the ellipsoid (around the player) will respond. And the player will move with the ellipsoid.

NOTE: The ellipsoid is an imaginary object around the player. The player might be an animated mesh itself, although you don't want to define in that way in the collision system.

Quote: "2.So does SetCollisionsPRO( TYPE_ELLIP, TYPE_MESH, ELLIP_2_POLY, RESP_STICK, DYN_RESP )mean the object will stop because that is what I understand from the reference manual? If im right where in the source code would I type the detecting for the ball hitting the paddle?"


Yes, the ellip will stick when it hits the mesh. There is no "ball hits paddle" command, as everything in the DLL is arbitrary. You define how your objects interact with each other. This also means that it's up to you to make the ball properly respond to the paddle. The collision system simply keeps the ball from going through the paddle and provides information about the collision.

I have already listed the "object detection" method above.



And that would go in your main loop.

Quote: "3.Does all the above go before the main loop and what bits would go in the main loop?
Thankyou"


The large part of the code goes before the main loop to define how things interact. That's the largest part of the setup. After that, it's fairly simple.

All that goes in your main loop is the command: RunCollisionPRO()

And, of course, any special handling you might want to do from object detection (code above in this post).

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 16th Apr 2004 13:24
Problems -
Setup all the above and got an error saying could not determine parameter type of 1 type_ngc_ellip at line 1.
Heres the code you might need it!


*For every problem you come across you gain something from correcting it, I hope.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 16th Apr 2004 19:18
What version of the DLL are you using?

1.5? 2.00? 2.03?

Are you using DBC or DBPro?

Have you included the "NGCollision.dba" into your project? If you're using DBC you must have the "include" line in the code.

Also, the top of your code should have the constants defined:



And if you're using the 2.03 version there are 3 9-digit keys to put in the StartCollisionPRO() function. So it would look like:



I'd fix your code but I don't know which versions of what you're using.

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 17th Apr 2004 10:45
Still got some problems:
I have all the code in my program no errors are appearing when I compile but when I execute the program doesn't start and returns me to the db editor(no errors though).If I run the program without any of the collision system code it works perfectly but when I put it back in it goes funny again.
I have dbpro,dll_2.01 and yes I have all the correct files for the collision system setup.
Please tell me what I am doing wrong.


Thankyou for all the help by the way.

*For every problem you come across you gain something from correcting it, I hope.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 17th Apr 2004 21:05
You did not create your pong ball and pong paddle objects first.

Something like:



And so on and so forth. I only made one entry, you'll have to do the others. The first parameter for the CollisionTypePro() statement is an object number. You must make sure to pass it an object number to an object you've created.

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com
Mr Monkey Man
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: UK
Posted: 19th Apr 2004 20:10
Well 2 days later and I still have a problem. I did exactly what you said in your last post but still no joy. Heres the code as it is now, just wondering if you can spot any problems I haven't. Thanks.


*For every problem you come across you gain something from correcting it, I hope.
nuclear glory
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 20th Apr 2004 23:39 Edited at: 20th Apr 2004 23:41
Okay,

I fixed the code. You said you were using DLL version 2.01 and the code I just built runs perfect for the 2.01 version.

Here it is:



Copy/Paste exactly as it is there. If it doesn't work then you're probably using the 2.03 version. Also, make sure you have the most recent patch of DBP installed.

Lead Programmer/Director
Powerful Collision DLL for DBPro and DBC: http://www.nuclearglory.com

Login to post a reply

Server time is: 2024-11-26 14:29:44
Your offset time is: 2024-11-26 14:29:44