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 Discussion / Sparky`s DLL - Collision with walls not working. Please help

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Dec 2008 23:57
Hello!

I am making a tank battle game, and I have the collision working for the ground height and the tilting working, but I can`t figure out how to apply collision to walls.

Can someone give me a quick example of a program colliding with a wall using sparky`s DLL? Just like in sliding collision, you
, how would you do that with sparky`s?

Just to show my progress, here is a small video I uploaded:

Tanks

00:00-45:00 is showing the collision with the ground and tilting of the tank, and beyond is showing how I miserably failed at the wall collision...

TheComet

Peachy, and the Chaos of the Gems

Laocoon
17
Years of Service
User Offline
Joined: 29th Dec 2008
Location:
Posted: 31st Dec 2008 03:47
This is what I have as my collision detection using what was provided with Sparky's dll, but I'm still working on it. The player will collide with the walls, but it's jittery. Also, whatever .x model I assign as my player model will fall hallfway through the floor for some reason, which I'm trying to figure out.

First use:


11 is the number of my player object once I've loaded and positioned it, and then I use:


to have level room model use collision also after loading and positioning the room.



The playergrav# variable is for making the player fall when jumping. You could delete that if you wanted to.

With the previous code and all of the functions pasted into the end of the program that come with Sparky's DLL, I get the jittery collision and the sinking halfway through the floor problem...if you find solutions to those two problems you should let me know. Hope this helps!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Jan 2009 00:49
Thanks, that helped a bit!

So, what is a collision normal?

Peachy, and the Chaos of the Gems

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 4th Jan 2009 01:01
A normal is a perpendicular to a plane. A collision normal is the perpendicular to the plane at the point at which two objects meet (collide). Take a sheet of paper. The normal to the paper is at 90 degrees on either side. Now put a marble on one side of the paper and put another one on the other side. Don't put one directly in front of the other, have them offset a bit but still touching. If you draw a line from one marble to the next, it should form an angle that is different from the paper's normal. This is the collision normal. If you were to leave the marbles exactly as they are and put another sheet of paper in between them but so the marbles were directly on either side of the paper (not offset at all) the angle of the new sheet of paper would be the plane that the collision normal is perpendicular to.

Enjoy your day.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Jan 2009 14:28
OK, I applied the "newx#+normx#/speed#", but if the speed is 0, I get the error "Runtime Warning ! Can not divide by 0!"

And the whole thing is jittery and jumpy, and I still fall through the wall...

Peachy, and the Chaos of the Gems

Code eater
18
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 4th Jan 2009 18:51
Im not really very experienced with sparky's collision.

But I watched the video and I have to say I am impressed. I have never physically tried but I can never work out how to make a thing jump when it goes off a ramp, but still adjust to the land when it is ont the ground.

nice one,,,

codeeater
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Jan 2009 19:43
Quote: "I have never physically tried but I can never work out how to make a thing jump when it goes off a ramp, but still adjust to the land when it is ont the ground."


Ah, that is easy.

You will have some variable called "grav#" or "playergrav#" or "gravity#". Find that, and set it to the difference of y# and oldy# of the player positions if it is currently on the ground. I wrote a quick example for you to work on if you are interested:



TheComet

Peachy, and the Chaos of the Gems

Login to post a reply

Server time is: 2026-07-05 18:36:33
Your offset time is: 2026-07-05 18:36:33