I have created a scene with some rectangular cubes (ie long tall ones)
However picking any of these is so inacurate that it's almost a complete
waste of time.
I'm crrently picking by bounds using..
pickCanvas.setMode(PickTool.BOUNDS);
pickCanvas.setShapeLocation(i, j);
pickCanvas.setTolerance(0.05f);
PickResult pickresult = pickCanvas.pickClosest();
in the listener. but no matter what i do the picking is inprecise. I've
tried all
of the following :
1:
Turned off the setBoundsAutoCompute and tried to setup my own bounds dfor
the object.
eg.
Create the object.
Create a bounds object
Set the objects bounds to the bounds object
Added the object to the transform (used for rotating) etc..
But it's still very, very messy.
I've tried with both a bounding sphere and a boundingbox. The bounding
sphere
seemed to apply some bounding area but was just as inaccurate as before.
I tried and tried but couldn't get the bounding box to work. If I setup the
boundingBox
eg.
myBox.setBounds(new BoundingBox(
new Point3d(1,1,1),
new Point3d(-1,-1,-1)));
and then add the Shape3D (myBox) to the transform above it as before then
unless
I have setBoundsAutoCompute on then everything dissappears.
As a last resort I tried picking by geometry but that was even more of a
nightmare.
I set up all the correct capabilities (or so I thought) but when i run it I
get..
Exception occurred during Behavior execution:
javax.media.j3d.CapabilityNotSetException: Shape3D: no capability to allow
intersect
at javax.media.j3d.Shape3D.intersect(Shape3D.java:434)
at
com.sun.j3d.utils.picking.PickTool.pickGeomAllSorted(PickTool.java:672
) at
com.sun.j3d.utils.picking.PickTool.pickGeomClosest(PickTool.java:736)
at com.sun.j3d.utils.picking.PickTool.pickClosest(PickTool.java:512)
at
KCNG_3DVis.KCNG_3DVisPickBehaviour.updateScene(KCNG_3DVisPickBehaviour.java:
66)
at
com.sun.j3d.utils.picking.behaviors.PickMouseBehavior.processStimulus(PickMo
useBehavior.java:153)
at
javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:167)
at javax.media.j3d.J3dThread.run(J3dThread.java:256)
even though I don't seem to have an option on a Shape3D to turn this on (ie
setCapability(Shape3D.ALLOW_INTERSECT)).
This option is available for the Shape3Ds geometry but setting that still
produced the same error.
So.. What is the answer..
I'm throughly confused and all out of options. All I would like to do is
simply pick an object in my scene and return
the userdata associated with it.
Any comments or suggestions (no matter how simple or longwinded they are)
would be welcome
because all this pull out of hair is making me bold.
Thanks in advance for your help
Andy Knight
Software Engineer
Syngenta
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".