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.

Dark GDK / Pick Screen Tutorial

Author
Message
Aldur
16
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 23rd Jul 2009 12:33
Hey all,
Just thought I would write a small tutorial (my first tutorial actually) on the use of pick screen as I had a terrible time getting it to function properly.

Please feel free to criticize and leave feedback if you have a better way of doing this, as this is the way I am able to successfully use pick screen.

Firstly we use the dbPickScreen command to get our vectors.



The first part of this command is the x value, to which the x value of mouse is assigned, using dbMouseX().
The second part is the y value and I have used dbMouseY().
For *Distance* I use my camera height (dbCameraPositionY()).

Now that we have our pick screen command in the loop, we get our values from it and assign them to variables.



I have used the prefix 'v' on my variables to specify that they are vectors.
You must use the dbGetPickVector(X,Y or Z) commands to pull the values from the dbPickScreen() command!

Next we store our camera's position in variables.


The x,y and z values are prefixed by cam, for obvious reasons.

A very important part of using pick screen, when striving for accuracy is the next piece of code.



The new variable 'mult' will be an accurate equation of the camera's y value over the y pick vector. dbABS() is a function used for providing absolute decimals, which increases accuracy a great deal (or so I believe ).

Our final equations are probably the most important of all when using dbPickScreen().



We multiply our original vectors by the absolute function and add our camera's position to it.
This allows the camera to move around and still have accurate pick vectors.

Finally we position an object at our vectors to see if it has been successful (which it has for me) and view the final result.



Position any object you wish as *Object ID*.

Thankyou if you have taken the time to read this, and please remember to leave constructive criticism if you feel the need!

Jamie.

Login to post a reply

Server time is: 2024-10-01 08:41:59
Your offset time is: 2024-10-01 08:41:59