Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 10:56:38 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)strange pick results..
Pages: [1]
Print
Author Topic: strange pick results..  (Read 1246 times)
hawkwind
Getting respectable
***
Offline Offline

Posts: 363



View Profile Email
« on: 23. December 2006, 10:20:28 pm »

I have adapted my game to use the current picking system shown below.  I periodically, in the same place in the game, get incorrect results.  Is there a "pick rectangle" or something that defines the area to pick within??  Basically I am on top of a more distant shape but the code is returning a nearer shape that is in the view but not where the mouse is.  I am guessing that an area around the mouse is the target "pick rectangle"??  can I minimize this if that is the case to tighten the focus??  Is the BoundaryBox of the shape involved?? Huh


Code:
synchronized (pickParamsMutex) {
if (picked) {

PickResult results = PickingLibrary.pickNearest(
C.lightBg, canvas, pickX, pickY);
if (results == null) {
   System.out.println("Pick results are null");

} else {
C.pickX=pickX;
C.pickY=pickY;
System.out.println("Picking at " + pickX + ", " + pickY);

/*display shape name
                         */
((GameHUD) C.hud).getFpsDesc().setText(
results.getShape().getName());

 
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 23. December 2006, 10:37:21 pm »

I have adapted my game to use the current picking system shown below.  I periodically, in the same place in the game, get incorrect results.  Is there a "pick rectangle" or something that defines the area to pick within??  Basically I am on top of a more distant shape but the code is returning a nearer shape that is in the view but not where the mouse is.  I am guessing that an area around the mouse is the target "pick rectangle"??  can I minimize this if that is the case to tighten the focus??  Is the BoundaryBox of the shape involved?? Huh

Well, in PickingLibrary picking there isn't any pick rectangle. It's just a mathematical ray (Ray3f), that is tested for intersection with the Group's Bounds, the Spape's Bounds and the Geometry (in that order). If the Group is not intersected, the Shape's Bounds are not tested. If the Shape's Bounds are not intersected, the Shape's Geometry will not be tested.

So far there's only BoundingSphere as a used Bounds implementation type. So it can be quite unprecise sometimes. But if the Sphere is intersected, the Shape's Geometry is anyway tested precisely. Well, maybe there are errors.

BTW: What are you using as the pick-mutex? I hope it's your VirtualUniverse instance as it should be.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic