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 Object is using 2d co-ordinates mousex(),mousey() and returns which object is under the mouse pointer." in reverse...

Author
Message
Siolis
18
Years of Service
User Offline
Joined: 19th May 2006
Location:
Posted: 5th May 2007 18:06 Edited at: 5th May 2007 18:07
"Pick Object is using 2d co-ordinates mousex(),mousey() and returns which object is under the mouse pointer.

Greetings, i want to put an object under the position of the mouse on screen for a terrain cursor, anyone got any idea how i might do this?

edit:

This in reverse basically:

dbPickObject ( int iX, int iY, int iObjectStart, int iObjectEnd )

A Dragons Legacy...a blog by S.R.Deoden
"Look you son of a suitcase..." - Rinsewind yelling at the Luggage in The Light Fantastic
Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 6th May 2007 15:31
You need to find out what the "pick vector" is that shoots from the camera position through the mouse pointer and then select some distance into the screen (along that vector) where you want to place the object.

To find the pick vector you can use



You can obtain iScreenX and iScreenY from the mouse position. After you call that function and obtain voPickVec, at distance "fDistance" you should be at the 3d point

pointX = dbCameraPositionX() + voPickVec.x * fDistance
pointY = dbCameraPositionY() + voPickVec.y * fDistance
pointZ = dbCameraPositionZ() + voPickVec.z * fDistance


Hope this helps.

I have vague plans for World Domination

Login to post a reply

Server time is: 2024-09-28 23:17:06
Your offset time is: 2024-09-28 23:17:06