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 / Still unable to pick objects !

Author
Message
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 24th Apr 2007 18:47
Using DarkGDK.NET, I still have problems trying to pick objects with the mouse ! The oDB3D.PickObject routine works fine, but only at a short distance (let's say 25 meters max).
So I tried the folllowing:
- Make a first oDB3D.PickScreen call with a distance that is the near camera range. That gives me P1 (3D point).
- Make a second oDB3D.PickScreen call with a distance that is the far camera range. That gives me P2 (3D Point).
- Make an oDB3D.IntersectObject call using P1 and P2 with every object that is visible in the camera. Problem: oDB3D.IntersectObject returns 0 for every single object visible !
Obviously the next step is to commit suicide, but what will my wife and my daughters say? Also, at TGC are you ready to endorse that awful responsibility ?
Can anybody help?
Thanks,
Thierry
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 25th Apr 2007 11:50 Edited at: 25th Apr 2007 12:18
While dbPickObject works -on its side- at DGDK, it is true that doesn't work for very distant objects, I'm talking about, let's say >100000 engine units. How many units are 25 meters for you?

If you want to check positions far away than that, I recommned that you calculate it by yourself, knowing the object's coordinates and using 3D to 2D projection.

Have you checked that P1 and P2 are filled with a value? I remember IntersectObject was recently updated, so I guess no need to ask if you are using the latest GDK.net.

[Edit] I forgot to say that these kind of commands can fail also, even for close objects, if the camera range has too far away the far clip plane. Please stay with us
thierry st malo
19
Years of Service
User Offline
Joined: 7th Nov 2005
Location: Saint-Malo, France
Posted: 25th Apr 2007 15:43
Hi, Morcilla,
- For me, 25 meters is 25 units.
- I have tried to compute ray intersection with objects by myself, but there seems to be something wrong in the way DGDK.NET handles 4D vectors and matrices (I have already mentioned that in a previous post), as I get completely inconsistent results. I have the maths to dispense with that kind of things in DGDK.NET and do the computations by myself, but how can I get in a conventional VB Express 4x4 array the contents of the View matrix (or of any DGDK.NET 4D matrix)?
- Yes, P1 and P2 are filled with correct values.
- Yes, I use DGDK.NET version 1.0.9.
Thanks anyway,
Thierry
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 26th Apr 2007 13:29
25 units is rather close. I'd suggest to make some test code to prove that DGDK.NET handles 4D vectors and matrices wrongly.

To know some 3d position at the screen, there is no need to dig inside 4x4 matrices, just use the dbProjectVector3 command and you can make your own my_pickobject function.

Login to post a reply

Server time is: 2024-11-19 13:39:53
Your offset time is: 2024-11-19 13:39:53