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 / help with collision please

Author
Message
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 02:49
i am going to say this staight out im new to darkbasic and have been playing with it for only a couple of months now. some of you have probebly seen my complaint before here we go again one last time . all im tring to achieve is collision without leaks in a 4 wall room . the collision is on for the car and the 4 walls as well , they are all set for box collision. Every thing is fine and works well until i go into a corner, then the car will pass inbetween the collision boxes where they intersec each other. Ive tried just having the wall touch, not touch, and overlap each other but it still happens each time.
I remember that somebody had made a statement claiming that its because im hitting 2 collision boxes simultaneousely which at this point from playing around does seem to be the case. Why? Hasent anybody ever made just a simple room and had objects not pass through the corners? is it becuse it sliding collision that just slides inbetween the walls?
yes i know about the nucleargloydll. look at it but seeing how its more or less made for somebody whose already familiar with darkbasic.
The boxes work fine when the car hits them individualy. is static collision the only way to resolve this ?

How does one set up the box? is it done only by the center point of the matrix or does matrix placement also play into the settings as well? Can i just place the car on the matix or do i have to give a starting position with 6 coordinations of it as well? I've looked at the demos and on the forums and their isn't one decent SIMPLE example of this stuff anywhere. I even read the book 752 pages ,understand most of it. its kind of like the old basic i grew up with as a kid using the c-64 and apple IIe, but the book coved nill on the darkbasic 3-d stuff. go figure. still good reading never the less.

Any how 4 walls one object moving collision leakes when 2 collision boxes are hit in the corners of the room. Its so simple yet im completelly lost. please somebody help explain the situation , I cant be that dumb can I?
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Nov 2003 03:54
Try this I just knocked up - maybe give you some inspiration




Boo!
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 18:08
thanx for advice spooky. I see where your going with this, tried the code snippet, works alone, tried useing in my project and it goes wacko. Now when i hit the walls the car pushes them around like a bulldozer . This doesnt make any sense plus you may have missed what i was trying to say, or mayby not. I got collision when i hit the walls individually that wasnt the problem. The problem was when i would hit 2 COLLISION BOXES SIMULTANEOUSLY. Sorry not shouting just emphisizing somethig that people dont seem to get. Ive asked this before and nobody seems to understand the question they ramble on about having collision on or the nuclear glory dll and completely advoid answering my question.

The problem is NOT collision with individual object that has always worked fine. The problem is when 2 OBJECT COLLISION BOXES INTERSECT each other . Think of a corner in your house , walk up to it, put your fingers in the corner so you are touching both wall. Now imagine that when you are toching both walls simultaneously your hand goes through. This is the problem that im tring to stop from happening. Im not tring to be a jerk it just somthing ive stuck with this collision problem for 2 weeks now and am begging to think that darkbasic cant do collision with more than 1 object at a time, as somebody at the forum pointed out to me earlier.

Still thanx i will play around with your snippet though. By the way nobody still hasent cleared up the static collision. So here is my thing. I made matix size 125,125,10,10. Would i just use these numbers to set up a collision box or do i also have to put position matrix x,y,z into the equation as well. and with the object placement can i just use x,y,z or do i have to use the 6 points (-/+)xyz as well. Sorry but i am still new and asking for a little clearification of this stuff.

once again people any advice is appreciated , thanx
CoTang
22
Years of Service
User Offline
Joined: 18th Nov 2003
Location:
Posted: 22nd Nov 2003 18:46
Have you tried using a condition where it checks to see if you collide with BOTH objects?

Not sure how your code is, but I figure you have something like this:

If Object1(car) hits Object2(wall) then do this
If Object1(car) hits Object3(wall) then do this

You could add somthing above like

If Object1(car) hits Object2 AND Object3 then do this

Then check for individual collision.
If Object1(car) hits Object2(wall) then do this
If Object1(car) hits Object3(wall) then do this

This is condition is pretty big and might slow down your game unless you are making it for an ultra fast system....

My 2 cent
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 19:45
i,ve thought about this and will try it i was hoping for something more simpler then having to write collision checks for each individual object. After all it would seem like it would seem that way when your only useing 4 object to build the room. Thats not even putting into effect that i evetually want a computer enenmy, barriers to hide around health and power ups as well. Thats going to be alot of individual collision checking in the end. Question, if i was to make a wall clone its mesh into four objects place them to create a boxed room then use a single variable to define all four , would this reduce the collision checking and simplify the situatiuon?
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Nov 2003 20:48
I'm confused! I gave you snippet that does EXACTLY what you asked for. It has a room with four walls where walls intersect each other at the corners. When blue box is moved into a corner it collides with both walls at once and slides accordingly. Just what you wanted.

The collision boxes have to be defined as 2 points in space (2 sets of x,y and z coords). This defines the area in between as a nogo area.

You must be doing something really odd if your car is actually pushing the walls like a bulldozer!

Having a matrix does not affect collision whatsoever.

If you are still stuck, feel free to post your code here or if you don't want anyone else to see it, email to me (address is on my website).


Boo!
Carlitos
23
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 22nd Nov 2003 22:11
Quote: "You must be doing something really odd if your car is actually pushing the walls like a bulldozer!"


LOLOLOLOLOLOLOLOLOLOL, WOW, thats pretty funny!!!
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 22:14
spooky
i ran your snippet as it was but when i ran it, it would not except the function makebox part that was make object collision box o,-x,-y,-z,x,y,z it didnt reconize these variables that where negative points yes i cut and paste the program . So i put numbers in the place of the x,y,z matching those that wherefor object 10. Am i doing something wrong here? Anyways what came up was a blue back ground with 5 boxes that where cubed seperated apart at far distaces across the screen with a sixth box that i could only move back and forth and spin. The collision worked fine on your snippet but because the boxes for the walls where so small and so far apart there was no way to test if the object would pass through two boxes if touching. Two wall objects not one wall plus the object .
Your cubes are only 50,50,50 but they seperated by a distance of over 200 each. I'm going to try make a very short snippet of what ive got so mabey you can all see what it is that im talking about.

please be patient with me
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 22:29
hold on redid the snippet again this time i have rectangular walls.
my apoligies spooky im going to play the controls so i can curve the object into the cornrs to see what happens. It was 3am when i did this earlier so i may have just been stupid or something
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 22nd Nov 2003 23:07
global t=2
sync on : sync rate 0 : autocam off

makebox(1,500,50,50)
position object 1,0,0,250
color object 1,rgb(255,0,0)

makebox(2,500,50,50)
position object 2,0,0,-250
color object 2,rgb(255,0,0)

makebox(3,50,50,500)
position object 3,250,0,0
color object 3,rgb(255,0,0)

makebox(4,50,50,500)
position object 4,-250,0,0
color object 4,rgb(255,0,0)

makebox(5,50,50,50)
position object 5,100,0,0
color object 5,rgb(0,255,0)

makebox(10,50,50,50)
color object 10,rgb(0,0,255)
position object 10,0,0,0

position camera 0,100,-400
point camera 0,0,0

do
forward =0
reverse=0
x#=object position x(10) : y#=object position y(10) : z#=object position z(10)
if upkey()=1 then move object 10,1:forward=1
if downkey()=1 then move object 10,-1: reverse=1
if leftkey()=1 and forward > 0 then yrotate object 10, wrapvalue(object angle y(10)-3)
if leftkey()=1 and reverse > 0 then yrotate object 10, wrapvalue(object angle y(10)+3)
if rightkey()=1 and forward > 0 then yrotate object 10, wrapvalue(object angle y(10)+3)
if rightkey()=1 and reverse > 0 then yrotate object 10, wrapvalue(object angle y(10)-3)
if object collision(10,0)
dec x#,get object collision x()
dec y#,get object collision y()
dec z#,get object collision z()
position object 10,x#,y#,z#
endif
sync
loop

function makebox(o,x,y,z)
make object box o,x,y,z
make object collision box o,(-50/2)-t,(-50/2)=t,(-50/2)-t,(50/2)+t,(50/2)+t,(50/2)+t,0
endfunction

Rem Project: test
Rem Created: 11/22/2003 3:45:12 PM

Rem ***** Main Source File *****

this is a modified part of your snippet what i did did was put numerical values for the make object collision box in the function statement to match those of object10. Am i doing something wrong ?
It would not except the -x,-y,-z as being so and if you test this you will see that there are leaks in the collisions
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 23rd Nov 2003 00:22
[/code]figured it out! also poligies for the screwed up code snippet

any how this is what i came up with
it also has better control of the box so it isnt spinning crazily actually curves more when moving forward.
what i did was went back to the function statement and where it was having problems with the negitves in the xyz eleminated the numbers put back the xyz eleminated the - symbol kept the /2 but then multiplied it by -1 then subtracted by t
[code]
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 23rd Nov 2003 00:27
[/code][code]
how in the heck do you get the snipping to work?
i dont want to take up the forum with stupid coding again?
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 23rd Nov 2003 00:31
Stormbringer
22
Years of Service
User Offline
Joined: 1st Oct 2003
Location:
Posted: 23rd Nov 2003 00:41
by the way spooky thank you. Your help has been a blessing,by the way what putting the snippet i posted above in the code base for all the other new dummies like me? I'm asking you because you pretty much did it all
thanx
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 23rd Nov 2003 01:18
If you are having problems with the negative values, e.g. -x then you are running a really old patch that does not handle these. This is why you are getting compiler erros. This was fixed AGES ago!!!!

Upgrade to 5.1!!!


Boo!

Login to post a reply

Server time is: 2026-07-26 15:31:15
Your offset time is: 2026-07-26 15:31:15