Hi,
I use the following code to perform a pick, but it
returns "RestrictedAccessException: Cannot
modify capability bits on a live scene or compiled object"
What kind of setting do I need to avoid
this?
many thanks in advance
OLivier.
scene.setCapability(Node.ENABLE_PICK_REPORTING);
(...)
// build pick ray object from ray origin and
direction
PickRay ray = new PickRay(rayOrg, rayDir);
// throw the pick ray into the scene at all the leaf shape
// nodes under the pick root SceneGraphPath paths[] = scene.pickAllSorted(ray);
if( paths != null) {
// shape target bounds were hit, check for real hits
for( int hitI= 0; hitI< paths.length; hitI++) { System.out.println(" hit [" + hitI+ "]=" + paths[ hitI]);
// intersect pick ray with shape target geometry
Node shape = paths[ hitI].getObject(); double dist[] = {0.0}; Shape3D obj=( Shape3D) shape; obj.setCapability(Shape3D.ALLOW_GEOMETRY_READ); //same problem when the capabilities are set directly in the BG scene obj.getGeometry().setCapability(Geometry.ALLOW_INTERSECT); boolean isRealHit = obj.intersect(paths[ hitI], ray, dist);
if( isRealHit) {
// compute hit point from hit distance and pick ray Point3d point = new Point3d(); point.scaleAdd( dist[ 0], rayDir, rayOrg);
System. out. println("real hit at " + point);
}
}
} (most of this code comes from the java boutique web
site)
|
- Re: [JAVA3D] exception while picking Olivier Tassy
- Re: [JAVA3D] exception while picking Cheng Chang Dong
- Re: [JAVA3D] exception while picking Olivier Tassy
- Re: [JAVA3D] exception while picking Yazel, David J.
- Re: [JAVA3D] exception while picking Olivier Tassy