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.

Code Snippets / Clicking on 3D objects with mouse cursor (converting 3-D to 3-D)

Author
Message
8truths
20
Years of Service
User Offline
Joined: 10th May 2003
Location: United States
Posted: 3rd Aug 2003 10:36 Edited at: 3rd Aug 2003 10:39
Someone had asked for this about a week ago, and I don't recall them get a satisfactory response.

If they did, post a link to the response so I can tweak this code; it's still very rough.

. . . As long as you click the middle of the object, you're good to go.

Once it gets closer to the camera, the further edges are not clickable, but probably 50-70% of the middle will be.

Use the arrow keys to move the object.



We can't stop here! This is bat country!
UberTuba
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 3rd Aug 2003 14:37
theres a command thatwill do that for you in dbpro

the artist formally known as darkfluff
8truths
20
Years of Service
User Offline
Joined: 10th May 2003
Location: United States
Posted: 3rd Aug 2003 20:02
I suspected. Still too sheap to upgrade.

We can't stop here! This is bat country!
AzureZeal
20
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 4th Aug 2003 00:30
Check out james's 'bullet' style code. It sends a imaginary bullet from the mouse cursuror out into 3d space. Then you can use dbs collision or your own collision code to detect if the bullet hits anythings. Its great because it works for matrixes AND objects.

http://www.darkbasicpro.com/apollo/view.php?t=13689&b=6

8truths
20
Years of Service
User Offline
Joined: 10th May 2003
Location: United States
Posted: 4th Aug 2003 08:24
i've done something Similar. Also a wand that just is moved in 3D by the mouse works well.

We can't stop here! This is bat country!
cecil seaside
21
Years of Service
User Offline
Joined: 18th Sep 2002
Location:
Posted: 11th Aug 2003 01:24
"theres a command thatwill do that for you in dbpro"

What command?
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 11th Aug 2003 01:32
In update 5 there are some new commands. Main one of interest here is:

PICK OBJECT
This command will return the Object Number of the closest object at the specified screen coordinates. The objects that are tested against the 2D
coordinate are only those within the Object Start and Object End range in order to speed up specific tests. If no object exists at the coordinate, a
value of zero is returned. If an object number is returned, additional data will be generated and stored internally. This extra data can be retrieved
using the GET PICK VECTOR and GET PICK DISTANCE commands.

SYNTAX
Return Integer=PICK OBJECT(Screen X, Screen Y, Object Start, Object End)

The programmer formerly known as sonic

Login to post a reply

Server time is: 2024-03-29 08:01:33
Your offset time is: 2024-03-29 08:01:33