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

Author
Message
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 18th Aug 2004 18:51
I’ve been at this for hours now. I know there are many questions about this asked. But I have spent lots of time tiring to figure it out on my own. I read thought the manual, I read though many pages on the forums, and search the net. I checked the code base and I tried everything I read, but for some reason I just can't get it. I have to be doing something wrong here.

I have a .X model and I have a box I made in DB. I want the .X model to collide with the box. I know your probably thinking WTF but that’s all im trying to do, believe me its part of a bigger picture. But anyway im sure to do something like that would be very simple. I'm not tiring to use the Nglory.dll I just want to use the BD commands available to me for this. If you need me to post my source I can, but I doubt it would be any help, cause honestly I've gotten no where with it.

I know it sounds simple and im sure its just one little thing im missing. but at this point i'm just really tired and its late, maybe I just need some rest. but if anyone can help by giving me an example and maybe some good remarks Id greatly appreciate it. Collision is the one thing I always have trouble with.

maybe someone who’s good at collisions should make a big post about it explaining it and have it stickied to the top of the page that would be cool, and then it could minimize collision questions.

Anyway I did try looking it up on my own and failed and I really need sleep now, so if someone could help me I would greatly appreciate it.


thanks in advance
JerBil
21
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 19th Aug 2004 03:21
This code should work for an .x model too, but I've used cubes.

-JerBil
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 19th Aug 2004 04:33
i think i understand what your doing. But when i try to run your code or mine the way you have it. the part that sayes

if object collision (thing,block)

it keeps giving me a syntax error that sayes unrecognized parameter
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 19th Aug 2004 04:43
never mind i figured it out. Thanks alot man you were a big help!!!!!



Gowmars
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 19th Aug 2004 05:40 Edited at: 19th Aug 2004 06:25
bleh >.< ok another question. some of the boxes that i set collison to, the object will collide before it actually reaches the box. like it will stop moving and it wont even be touching the box there will be a big space in between the two objects.

It works fine when i make a cube collide, but when i use my .x/.3ds model, i collides before it touches the box


well that wasn't in the form of a question, but you get the idea, a statement id like a response to.
JerBil
21
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 19th Aug 2004 06:51
Gowmars, I don't know if this is the right answer, but you can
try setting the collision radius of your .x object. The smaller
the radius, the closer before collision is detected.
Here I've used a radius of .5. A radius of 10 will collide well before contact. -JerBil

set object radius thing,0.5
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 19th Aug 2004 08:09 Edited at: 19th Aug 2004 08:10
Yeah, many collisions are detected by using invisible boxes or spheres around the objects in question, so having a collision declared before the seen graphics touch israther common unless you make adjustments. Why use invisible boxes or spheres? They're faster and easier to code than pixel perfect ones. You just have make a slight adjustment.

Any truly great code should be indisguishable from magic.
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 19th Aug 2004 11:59
Well right now thats what I have done. where my walls are I also have boxes that are invisible and am using the boxes for my collision. my character model witch is a .x collides just fine with all the boxes except for one.
There is a wall at the top of the screen one to the left, one to the right and one at the bottom.

-------------------
| |
| |
| |
| |
| |
-------------------

the wall at the bottom the object collides with it before it hits the box, but it collides just perfect with the other 3 walls

but it could be the object radious.
JerBil i used the command set object radius thing,0.5 but it kept telling me syntax error unrecognized paramaters!?!?!?!
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 20th Aug 2004 03:06 Edited at: 20th Aug 2004 03:07
Well I have never heard of that particular command before so I can't advise you there. As for the other, I wonder -- is it possible you may have aligned your collision boxes to the wrong face? What I mean is, if the boxes are set up as;


---- box here.
|--|
----
_____________ (wall here)

rather than;
____________ (wall here)
----
|--|
---- box here.

You will get a collision before you reach the wall. You have to make sure the faces "line up" to the edge of the wall.

good luck.
S.

[Edit] Gee I hope that graphic makes sense... sure looks awful in text like this.

Any truly great code should be indisguishable from magic.
JerBil
21
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 20th Aug 2004 11:14
The Set Object Radius command is in DBPro, so that may be why. Sorry, I was not thinking as usual. Anyhow, invisible boxes should
work. Have you tried one at your .x model's location instead of at each wall? Just set the invisible box to the current model position so it will go with it, and check collision between box and walls.

Size the box for best results, I would think.

-JerBil
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 20th Aug 2004 13:20
If you want more precise hits you can try defining collision boxes and using sliding collision. Most of the examples on my site use collision detection of one sort or another. Here's a place to start.
http://www.geocities.com/hifin2003/sliding-collision.html
I'll be away for a couple of days. So if you reply and I don't respond it's because my arms can't reach the keyboard.
Gowmars
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location: United States
Posted: 20th Aug 2004 14:09
thats a very good idea Jerbil I can just make an invsible box and have it stay in the same place as my .x model and set collision to the box. Ill do that it should work great.

Thanks to all!!!!!


gowmars
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 20th Aug 2004 19:44
Well, this is the Classic board so I'd have expected Classic references only...
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2025-05-25 10:31:31
Your offset time is: 2025-05-25 10:31:31