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 / Mouse XYZ to 3D XYZ?

Author
Message
deathAngel
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location:
Posted: 16th Feb 2003 23:57
Hi, could someone give me example of a code to convert mouse X,Y,Z values to 3D X,Y,Z values.
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 17th Feb 2003 00:26
Not at all easy I am afraid. There are a few examples in the Code Snippets forum on the RGT forums (http://www.realgametools.com)

NOBODY has a forum name as stupid as Darth Shader. I do.
Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 17th Feb 2003 21:02
You could try picking a few points out in 3d space and read off their object screen x(objectNo) and comparing them to the mouse position.

By creating an invisible handler object and using a for next loop you could check an area, something like this example below.



If this isn't accurate enough or fast enough you could use two loops, the first checking at step 100 the second checking at step 10 around the area found by the first loop.

There's other methods i'm sure - it really does depend on what you are trying to test, what volume of space you are checking within, what objects and/or mapping solution you have used.

In an RTS for example, you'd probably be better off checking the range difference between the mouse xz() and object screen xz() for each unit rather than work out where exactly you are clicking. If you want a highly accurate crosshair making your mouse a 3d object might be the way to go....

I hope this helps.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
Andy Igoe
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 17th Feb 2003 21:04
object screen z() should be object screen y() I think.

2D+3D Y or Z axis = Confused me.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
D Man
22
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Germany
Posted: 17th Feb 2003 22:50
Here's an example:



"If you can't make it good
make it look good."
Bill Gates

Login to post a reply

Server time is: 2025-05-18 18:48:33
Your offset time is: 2025-05-18 18:48:33