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 / 3D object selection(No question, solution)

Author
Message
cusoi
22
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 15:03
I see alot questions, I don't know this has been done already, because I don't need it, but I've been playing around a bit. And I have made a function. It's very simple. It just makes a tiny little sphere that moves from your camera position and then 1000(meter?) away. When it collides the function returns the number it collides to otherwise zero is returned. This is the function with an example program how to use it:
Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk
cusoi
22
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 15:15
It's really fast and accurate, it will always select the object when you're mouse is on it, but if you click a tiny milimeter away from the object it doesn't work!

Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk
Furiousuk
22
Years of Service
User Offline
Joined: 10th Jan 2003
Location: United Kingdom
Posted: 6th May 2003 19:57
Thats a good function, but I use this when I want to find out which matrix tile I have clicked on. It is a subroutine because it returns three values (3D co-ordinates) and I can't make a custom data type.

In the example x#, y#, and z# are the actual co-ords of the camera; CameraAngleY#/X# is the y/x angle of the camera; DesX#/Y#/Z# are where the camera is pointing; iSegmentedx/z are the number of matrix segments in each plane and DesX/Z are the matrix tile number.
The matrix is placed at (0,0,0) and a translation can be easily coded into the example.
cusoi
22
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 23:17
Thank you very much! Good code, I will look how to convert it.

Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk

Login to post a reply

Server time is: 2025-05-17 07:07:37
Your offset time is: 2025-05-17 07:07:37