Hi,
I use Xj3d to build my scene graph. I end up with a scene graph
composed of IndexedLineStripArrays and TriangleArrays. I want the user
to be able to click an object and change its colour. The below code
[1] works for IndexedLineStripArrays but not for TriangleArrays. Is
says it has no colours [2]. The objects are different are different
colours to start with.
Where else can the colour information be? I suspect I should be using
behavoiurs for this. Any example code to do something similar?
Thanks for any help,
Hugh
[1]
PickCanvas pickCanvas = new PickCanvas(canvas, getLocale());
pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
pickCanvas.setTolerance(5.0f);
pickCanvas.setShapeLocation(mouseEvent);
PickResult pickResult = pickCanvas.pickClosest();
PickIntersection pickIntersection =
pickResult.getClosestIntersection
(pickCanvas.getStartPosition());
GeometryArray geometryArray =
pickIntersection.getGeometryArray();
for(int i = 0; i < geometryArray.getVertexCount(); ++i)
{
geometryArray.setColor(i, colour);
}
[2]
java.lang.ArrayIndexOutOfBoundsException: GeometryArray: has no colors
at javax.media.j3d.GeometryArray.getColors(GeometryArray.java:2987)
===========================================================================
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".