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 / Object Collision problem

Author
Message
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 10th Aug 2003 04:38 Edited at: 10th Aug 2003 04:42
I've got a wierd problem. I can select the ships and planets,
but I can not select the stands for the ships. This is driving
me nuts.

http://www.geocities.com/tzircher/dbp_debug.htm

Is there a bug in DBP that fails to detect big polygons or
something? (The stands are composed of large triangles.)

Of course, I tried box, sphere, and polygon collision, all to
no avail. Given that I can get some of them to work, I do not
think that it has to do with my code.
--
TAZ
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 10th Aug 2003 09:44
set object collision to polygons

Dang, what was I going to say?

I just got a pop-up that said my computer is vulnerable.

urrrggghhh
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th Aug 2003 12:34 Edited at: 10th Aug 2003 12:35
can you break it down to a snippet?, sometimes when you make a snippet you find the error before you even post , I am not quite sure what you are saying here, can you select some stands but not others?, or do the stands not select along with the models?, or have you tried other stands and they won`t select either, they aren`t that large anyway, are you running patch 5 beta with its object selection comands?, or is this some home brew object selection code?, have you tried just selecting a solitary polygon? then 2? then 4? sometimes you get subtle logic errors in your code that go right by you unless you simplify and isolate the code and rebuild carefully, sometimes just doing it a different way can crush an untrackable bug, I don`t realy have any ideas from what you said, try posting a snippet with the same problem if you can, cheers.

Mentor.

ps:if you want to try the beta then you will need Directx9, don`t try to install without it or you will get all sorts of hair tearing errors

Jonny_S
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 10th Aug 2003 15:43
Hey mentor thanks for that saved me some hassle! didnt D9 cause problems with grphics cards people having to update drivers etc? I'm kinda worried about downloading it :S
and seeing a pictures doesnt really help show us a snippet you know you want to

The man with no sig
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 10th Aug 2003 22:22
ICERGB, I've tried set object collision to polygons (and boxes, and spheres.) It is strange because some objects do return collisions and others do not.
--
TAZ
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 10th Aug 2003 22:36
Mentor, the problem is that when I cast a ray (a long box) I get object collisions for ships and planets, but not the stands. It is a home grown object object picking routine. I'll work on a snippet, but I'm at a lost as to why the same code for some models works and fails for others.

Got DirectX 9b, but only the 4.1 patch for DBP. I got the impression that the 5.0 patch was in beta and available to DBN members only. {Got the latest drivers for my GeForce 4MX peice
of crap video card as well. So, I can eliminate that.)

sMs, I included the picture since I thought the problem might related to relative polygon sizes and perhaps the ray is shoot 'through' the stand without colliding. The code is scattered across hundred of lines. Building a snippet will take a while and as Mentor suggested, perhaps it will be a gainful exercise to boot.
--
Thanks for the comments, TAZ.
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th Aug 2003 23:04 Edited at: 10th Aug 2003 23:15
they made the beta public, you can download it off this server and try it if you like, it does mean you will have to backup since it expires after a month or so, but the object pick is so cool, pixel perfect, I think if it is a homegrown code you may have some problem with the code, people make levels in x (basicly the same as the primitive models in DB) and don`t report collision problems with something the size of their world, so it seems unlikly a pick object is giving problems, cheers.

sMs : Dx 9 has been revised twice since they launched it (now at DX9.0b), so it should be fairly safe to install, the latest driver for your card is always a good thing anyway since it makes the system faster and more stable and more to the point better with Pro, you don`t think Uber coder Lee uses out of date drivers do you?.

Mentor.

zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Aug 2003 00:07
Thanks for the info, I'll give the beta patch a try and see if that fixes things for me.
--
TAZ
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Aug 2003 04:15
Well, pick object() does work, but it also ignores collison on/off properties. That's bad since it detects my sky sphere first and ignores the rest of the objects. Looks like I'll have to totally reorganize my object loading so that I can use the 'object range' properties of the function correctly.
--
TAZ
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 11th Aug 2003 10:11
turn off object collision on the skysphere model

Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Aug 2003 14:59
I am kind of puzzled by what you say, if it detects your skysphere (as it will since all the other objects are inside it) then just give it an id number like 30000 and set the range from 1 to 29999 tops, that way it won`t get detected, no need to rewrite the object load code (unless your highest numbered object is at the max Pro can handle).
Indi: I don`t think that makes any difference to pick object, it isn`t a collision based detection, it`s math based (and pixel perfect, whoohoo ).

Mentor.

zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Aug 2003 17:45
Mentor's right about pick object's function. It tests a range of object numbers regardless of their collision status. This is a small hurdle for me since my program reads in a config/game file and builds the world on the fly. I just needed to organize my object loading so that all the pickable objects are grouped together. That way I can still have my sky sphere and other non-pickable objects.

BTW, I may have spoke too soon about success. Once reorganized, pick object() did find my ship models but also failed to see the stands.

Grrr.... If it isn't the loading code or the picking code (which both work), I can only assume that the models for the stands are some how jinxed.
--
TAZ
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 12th Aug 2003 06:06
Sweet but bitter victory, an second reorganization of the object loading code and config files got hex stand object picking to work. The problem was that the planes forming the map sheets were being detected before the stands were, contrary to any logic I would have thought of.

Removing the hex maps from the object picking range fixes one problem, but introduces another. But, I now have a better understanding of how the pick object function will work.
--
TAZ
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 12th Aug 2003 06:24 Edited at: 12th Aug 2003 06:40
Well, I'm not sure why pick object() goes out of its way to select planes instead of the foreground models above it. I guess that it is only a big problem for wargamers that like to play with units on flat maps.

Fortunately, I have two object picking routines that I can use. So, I should be able to use one for models and hopefully the other for just the maps. It's just a matter of turning off the collision properties for everything but the maps.
--
Thanks to everyone that had the patience to help me while I worked this out, TAZ.
EddieRay
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 14th Aug 2003 01:12 Edited at: 14th Aug 2003 01:14
My guess is that the pick object command has no concept of one object being "in front of" another object on the screen... hence the "range of object numbers" setting. So, if you have *only* the "pickable" objects in the range you set for "pick object", then you theoretically should be good to go.

I haven't tried patch 5 yet, but this is one of the major features I'm interested in... if you find a bug with these picking commands, please report them so they get fixed before patch 5 non-beta is released.

spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Aug 2003 04:21
pick object is good but as well as problem with objects whose collision flag is off, it also picks hidden objects!

The programmer formerly known as sonic
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 14th Aug 2003 08:00
The pick object function works quite well. (Tested it in 5b2 and 5b3.) The kicker is that you need to organize your objects so that they fall into the pick range and only those objects. In my case, that was easy since I load the scene from a config/save file.

I wouldn't be surprised if it picked hidden objects since it is doing its own thing. So, hide and relocate will be the call if you have an object in your pick range and want to remove it completely.

It is tons easier to use than rolling your own picking routine (been there, done that.) Looking forward to this next update.
--
TAZ

Login to post a reply

Server time is: 2026-07-23 02:29:52
Your offset time is: 2026-07-23 02:29:52