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 / Intersect object question

Author
Message
Mussi
23
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 30th Sep 2003 20:14
Quote: "SYNTAX
Return Float=INTERSECT OBJECT(Object Number, X, Y, Z, ToX, ToY, ToZ)"


can some one tell me what to fill in where.
like what object number? live the level object or the player object?
X,Y,Z? the player coordinates?
ToX, ToY, ToZ? the point of the level object where you want to calculate distance from?

how is it posabel to make a custom poly-collision-check with intersect object?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2003 20:39
X,Y,Z is where you start.
ToX,ToY,ToZ is the point in the distance

I think it returns a value if there is anything crossing the path in between.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Flashing Blade
23
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 30th Sep 2003 21:24
if the object u specify is intersected by the line it returns the distance from x,y,z that the intersection happens
Mussi
23
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 30th Sep 2003 23:26
so, there is an invisable line drawn between X, Y, Z, and ToX, ToY, ToZ and the object you specify is the object you want to know distance between points from. but ho do i calculate distance between player position and a polygon of a level object ?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 1st Oct 2003 00:31
Basically you got it right..it gives the distance between the x,y,z starting point and the hit object polygon.
the second x,y,z set is the farest reaching point of your invisible line..normally this is set rather high (10000 or more) but not necessarily.
think of it as a radar beam
If you put the start x,y,z set at your player position / height then you can get the distance of any object intersecting the line.
BUT you need to use a different command for each object you may want to check distance with..unless your level is a single object itself..
Too many intersects may push down a lot your frame rate..
what i do with my trees ( thousands and builds ) is to scan the vicinity of them with a for-next loop with the famous square root check and trigger intersect only with the nearest tree ( or building)
hope it helped a bit
Cheers
Scorpyo
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 1st Oct 2003 00:34
A line is drawn invisibly from x,y,z to tox,toy,toz. As soon as object X is hit, the distance from x,y,z to this hit position is returned.

Unfortunately you can only specify one object, so level would have to be one big .x file.

The normal trick is to specify x,y,z as your camera x,y,z position and calculate the tox,toy,toz values as a point some distance in front of you and see how far it is from you to a wall in the level. This is the basis of collision.

If your mansion house needs haunting, just call Rentaghost!
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 1st Oct 2003 11:52
Is the intersect object command fast? Does it cause any slowdown or anything?

"It's amazin' what you can do with a computer and access to t'internet"
Mussi
23
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 1st Oct 2003 18:01
Quote: "what i do with my trees ( thousands and builds ) is to scan the vicinity of them with a for-next loop with the famous square root check and trigger intersect only with the nearest tree ( or building)"


could you tell me about that fameous square root check cuz I don't know it

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Oct 2003 20:19
Basically, it's just a distance check ... however if you are clever you'll find ways not to use it ...



These two pieces of code check exactly the same thing ... they 'DoStuff()' when the distance is less than 100 units, but the second is faster
Mussi
23
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 1st Oct 2003 21:31
thnx , just 1 more question, how many times can i use the intersect command without having an enormous framedrop?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb ddr sdram
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 2nd Oct 2003 01:10
Not easy to say..depends on rest of the code and PC specs..
Considering yours i would guess that over 8-10 simultaneous checks will be a killer..

Login to post a reply

Server time is: 2026-07-25 07:02:00
Your offset time is: 2026-07-25 07:02:00