I'm not the expert in Xj3d, but I expect my observation is true: maybe the TriangleArrays just don't have any associated vertex colours and uses some Material ?
Cheers, Florin -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] Behalf Of Mr H. Morgan Sent: Montag, 10. November 2003 10:18 To: [EMAIL PROTECTED] Subject: [JAVA3D] Changing the colours of objects with picking 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". =========================================================================== 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".