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 / NuclearGlory Question

Author
Message
cycloid gamma
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 22nd Nov 2003 20:48
Is there any way that the NG dll can tell which side is hitting when its hitting, what i mean is if the object hits a wall is there any way the NG dll can tell what side of my object collided against the wall, left, right, top, bottom, front, or back, and after its not hitting any of this areas it would just return a zero, if this is not possible then i dont see any way of creating a code for jumping with the NG dll which i must say is awesome. If this things are not capeble with the NG dll then is there any way to implement that to the dll.
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 22nd Nov 2003 21:29
Greetings,

The DLL comes with a feedback system to give the exact points/normals of the various collisions that may occur with your collision object.

The normals may be of best use in this case. A normal is basically a 3D vector with an absolute length of 1 that points toward the center of the ellipsoid from the contact point on the outside of the ellipsoid.

Therefore, if you had a collision with a Y normal greater than 0, then your colliding with a slanted surface that may be pointing completely toward the sky or perhaps just a wall that's very slightly pointed towards the sky.

If you wanted to implement jump code, it may look something like the following:



In summary, if you have a collision with a positive Y normal, the collision happened under the object. If you have a collision with a negative Y normal, the collision happened above the object. (The Y normal is negative because it's pointing from the contact point of the ceiling surface toward the center of your ellipsoid, so the normal is pointing downward, and therefore is negative)

And the same can be done with your other axis if need be.

Let me know if you have any other questions.

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
cycloid gamma
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 23rd Nov 2003 05:22
see basically what i need is something that as long as the object is hitting the ground the dll will return a -1 and as long as your object is not touching the ground it will return a different number say a 0.
nuclear glory
22
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 23rd Nov 2003 05:57
Here's how to handle that:



If you're hitting the ground, the "onGround" variable will be "-1" and if you're not touching the ground then "onGround" will be "0"

Change the line:

"if ynorm# > 0.3"

For how steep something can be before it's too steep to be ground anymore. If the value is "0.1" then it can be super steep and if it's "0.8" then it can't be very steep, etc...

And you're all set.

Lead Programmer/Director
Powerful Collision DLL for DBPro: http://www.nuclearglory.com
cycloid gamma
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 23rd Nov 2003 06:16
i tryed your code is working but when i print the value ongroun and the object is hitting the ground the value flickers from -1 to zero continiously, this is a lot better than what i had before but is there a way to have absolute -1.
cycloid gamma
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 23rd Nov 2003 06:22
Ok i got it now, my problem was that i was using a code to move my objects according to the internal clock of the computer and not according to the framerete, this was generating the flickering, when i changed the code to move the object according to the framerate, the dll returned absolute -1. Thanks a lot.

Login to post a reply

Server time is: 2026-07-26 15:29:41
Your offset time is: 2026-07-26 15:29:41