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 / Wall Collision

Author
Message
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 4th Dec 2005 04:32 Edited at: 10th Dec 2005 19:17
I have really been having some difficulty with my code
Here's my little program, when you run into the walls, you are supposed to stop, and NOT go through them. Right now, sometime you stop, sometimes you go through them, sometimes you jump to the other side of the map... I am really confused with what is wronge? Soes anybody know?

Am I dead yet?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Dec 2005 05:41
Could it have anything to do with the fact that you have both integer and float variables with the same name?

Dunno - just a thought.

TDK_Man

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Dec 2005 12:30
Why do you use intersect object?
If there is a collision, you can immediately use the object collision correction values (get object collision x/y/z() ).

Immunity and Annihalation makes Immunihalation...
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 4th Dec 2005 15:45
Perhaps because he's being smart and planning ahead for the time when having more than a simple box object comes along, for some reason people still think the get object collision and object collision() commands handle polygons, they don't.

I like using limbs for the intersection rays but some people prefer mathematics, either way the lag won't be too much of a difference.

Basically, add a triangle limg with dimensions 0,0,0,0,0,0,0,0,0 and then hide it for the smallest lag possible, now offset the limb on the z axis to be at the user's position + half of the user's z size.

Store the user's position in x#, y# and z# variables.

Finally, send an intersection check starting from the limb position, going to the user's position. If there's an intersection move the user to the x#, y# and z# variables.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Dec 2005 18:26
I'm pretty new to DBP but,

col=intersect object(obj,oldx#,y#,oldz#,5,y#,z#)?


obj=object collision(200,0)
col=intersect object(obj,oldx#,y#,oldz#,5,y#,z#)?
If col>0
dec x#,get object collision x()
dec z#,get object collision z()
endif

so he searches the distance of the collided object to the collision point of the raycasting oldx#,y#,oldz# to 5,y#,z#. And if that distance is bigger than 0, adjust the position?
I don't follow his redenation here.

Immunity and Annihalation makes Immunihalation...
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 4th Dec 2005 19:52 Edited at: 4th Dec 2005 19:54
That command will work, but ony correctly for primitives like boxes and spheres. Because that command uses collision boxes, and collision boxes are just invisible boxes stretched to the object's dimensions. So if you had a house and an open door, and you wanted to go into the house, using the DB collision commands would result in stopping you from entering since it's not polygonal collision detection, it's collision boxes.

The intersection check takes care of this.

I believe what he's doing here is trying to minimize lag by first checking if the user is colliding with the collision box of the object, if so then he further checks for intersection , thus stopping the checks from occuring when the user isn't even close to the object.

But then he switches back to using DB collision commands, I'm not sure what he's doing there.

Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 4th Dec 2005 21:07
Nobody has answered my question? Do you know why the collision is acting wierd? I'm totally lost with it.
@ RUCCUS you mentioned me switching back to DB commands... well is there another better way to make you stop when you collide into an object?

Am I dead yet?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 5th Dec 2005 00:57
...I posted the correct code -_-

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 5th Dec 2005 00:57
...I posted the routine, use intersect object like I said.

Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 6th Dec 2005 00:33
Oh.... that's what you were doing. I'm still a little noobish, I don't know how do that limb things... how would I make a triangle limb, and attatch it to my object?

Am I dead yet?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 7th Dec 2005 03:50 Edited at: 7th Dec 2005 03:51
Just check out the newcommer's guide to creating first person shooters, go to the index and look at how it handles collision, it should get you started.

[href][href]ruccus.net/Tutorial.htm[/href][/href] <-- The Site

Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 9th Dec 2005 03:25 Edited at: 10th Dec 2005 04:38
Oh Ok... that tutorial is very nice, thx

Am I dead yet?
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 10th Dec 2005 04:41 Edited at: 10th Dec 2005 19:17
Ok... the tutorial helped... and yet I am faced with another problem, now... I don't move. I know it's something with the collision again, and I tried changing thing as much as I could, but I am very bad at the intesect object collision... Please Please help

Am I dead yet?
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 10th Dec 2005 19:17
Oh yes. I fixed most of the problems, and now it is working together nicely, but... I have another strange problem. I can enter one side of all of the cubes, but the other side is solid just like I want it to. I think that it must have something to do with collision boxes, so... once again, any help please?



Am I dead yet?
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 13th Dec 2005 00:08
Um... can anybody help? I'm lost, i tried just about everything with the collision boxes. Yet I'm still not any closer. I think it has something with my extreamly limeted knowledge of collision... please please. Any help? (see code above)

Am I dead yet?

Login to post a reply

Server time is: 2024-09-24 11:27:03
Your offset time is: 2024-09-24 11:27:03