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 / proximity detection... or something

Author
Message
diseased
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 28th Aug 2003 08:40
i made a mouse pointer out of a 3d object, and i need to get it to select other objects.. except the only way i know of to detect an objects position is its exact x,y,z coordinates, which is almost impossible.. so is there a way to make a proximity?..
so i can click within 5 or 10 units of the object's actual xyz, and still select the object? or possibly even do something with collision.. but i dont know how to check if collision is occuring with a specific object.
ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 28th Aug 2003 10:20
you can now use the pick object command in dbpro! this makes it all alot easier



in dbc however it is harder


diseased
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 28th Aug 2003 10:58 Edited at: 28th Aug 2003 11:22
ok, that works good, but on the other hand it seems that pick screen doesnt work so well.. i did it just as the examples say, but it doesnt seem 2 work so well.. i got it 2 do what i want.. sort of.. i wanted to click on an object, set a flag, and then the object moves to the flag.. (strategy game like) except pick screen doesnt really put the flag on the screen where i click, and it always puts it way out of my view.. not anywhere close to where i clicked.. and what does distance value do?..
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 28th Aug 2003 13:08
You detect the distance between the mouse and other objects, using this function that return the distance between two objects:



Or you can use object screen x() and object screen y() to see if your target object's x/y is anywhere near the mouse's.

There's no place like 127.0.0.1

There are 10 people in this world, those who understand binary and those who don't.
diseased
22
Years of Service
User Offline
Joined: 16th Aug 2003
Location:
Posted: 29th Aug 2003 07:59 Edited at: 29th Aug 2003 08:57
well i got that to work but now im trying to figure out how to make the distance accurate.. i dont know if it is even possible.. because my camera angle can change and its height can change as well, which leaves the its going to be hard.. this is going to take some math skills i forgot a long time ago, or a command :-p

i could triangulate a position, but idont have enough info now.. i have the height, and all of the angles..

is there a way to make and find the legnth of an immaginary line that extends from the camera's facing until it intersects with an object within the game?

if i cant figure this out im going to be stuck with having to make my camera stuck to a 45 degree angle.. and that will stink..
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 29th Aug 2003 10:01
Try my tutorial on pick object / screen:

http://www.thegamecreators.com/?m=forum_view&t=15701&b=7

The programmer formerly known as sonic

Login to post a reply

Server time is: 2026-07-25 08:12:13
Your offset time is: 2026-07-25 08:12:13