hi all!
i'm having trouble trying to set up picking for my terrain-rendering demo.
my scenegraph looks as follows:
locale-------------------|
| |
terrain (BG) objects (BG)
| |
1-n patches (SHAPE3D) ship (SHAPE3D)
i'm using by-ref geometry for the terrain-patches.
i initialize every patch with:
PickTool.setCapabilities(patch, PickTool.INTERSECT_FULL);
the following code is used inside a behavior which wakes up every frame:
private void checkCollision(Shape3D ship) {
PickTool pickTool = new PickTool(terrain);
pickTool.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
PickBounds pickBounds = new PickBounds(ship.getCollisionBounds());
pickTool.setShape(pickBounds, new Point3d(0, 0, 0));
PickResult[] resultArray = pickTool.pickAll(); <--------- throws
exception
if (resultArray != null && resultArray.length > 0) {
System.out.println("got PickResult(s)!");
}
}
the pickAll() method throws the following exception:
Exception occurred during Behavior execution:
java.lang.NullPointerException
at
com.sun.j3d.utils.picking.PickIntersection.setPointCoordinatesVW(PickIntersection.java:376)
at com.sun.j3d.utils.picking.PickResult.intersectTri(PickResult.java:1024)
at com.sun.j3d.utils.picking.PickResult.intersectTA(PickResult.java:1288)
at com.sun.j3d.utils.picking.PickResult.intersect(PickResult.java:799)
at
com.sun.j3d.utils.picking.PickResult.generateIntersections(PickResult.java:635)
at com.sun.j3d.utils.picking.PickResult.numIntersections(PickResult.java:422)
at com.sun.j3d.utils.picking.PickTool.pickGeomAllIntersect(PickTool.java:809)
at com.sun.j3d.utils.picking.PickTool.pickAll(PickTool.java:463)
at FrameUpdateBehavior.checkCollision(FrameUpdateBehavior.java:70)
at FrameUpdateBehavior.updateData(FrameUpdateBehavior.java:125)
at de.netzkral.j3d.behavior.UpdateBehavior.processStimulus(Unknown Source)
at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
at javax.media.j3d.J3dThread.run(J3dThread.java:250)
systemsetup: win xp home-edition, java3d1.3(opengl), jdk1.4.0_01.
any help is welcome,
thnx in advance......
holger
===========================================================================
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".