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 / 3d Co-ord problem

Author
Message
Siege1975
21
Years of Service
User Offline
Joined: 27th Jul 2004
Location: UK - Wiltshire
Posted: 18th Jan 2011 15:33
I need to check an xyz co-ord is within a certain xyz box.

In other words i want to check player xyz is at another xyz with a tolerance of say +/- 100 units. thus making a sort of detection box.

The trouble is I can't seem to get my head around this one at all. Obviously I can check the exact co-ords but I would like a bit of an error margin built in.

Can someone please help me out with this one, I really can't seem to see the wood for the trees.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jan 2011 15:46 Edited at: 18th Jan 2011 15:49
Here you go:


EDIT: oops forgot the z part...

Siege1975
21
Years of Service
User Offline
Joined: 27th Jul 2004
Location: UK - Wiltshire
Posted: 18th Jan 2011 19:54
Excellent thank you!

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Jan 2011 21:47
No problem.

Moaz
15
Years of Service
User Offline
Joined: 18th Jan 2011
Location:
Posted: 19th Jan 2011 01:35
ok I've a question..
why don't you use a hidden box and check if there's a collision between it and the player or whatever ??
What are the disadvantages?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Jan 2011 09:53
Quote: "ok I've a question..
why don't you use a hidden box and check if there's a collision between it and the player or whatever ??
What are the disadvantages? "

The only disadvantage (other than maybe speed if your player object is complex) is that if your player moves quickly enough then he might completely fit within the box and then the collision check would return zero because I believe it checks for clashes between polys not between volumes.

Login to post a reply

Server time is: 2026-07-18 02:08:24
Your offset time is: 2026-07-18 02:08:24