I won’t bother the github people – I want to traverse the Mesh Object3D object. The routine I have uses Object.getPrototypeOf to follow the prototype chain. It fails with “Uncaught TypeError”. The following is a simplified routine to go up the chain. It fails. It probably involves “toJSON” somehow. TIA.
<!doctype html> <html> <head> <title> D-C </title> <script src="http://threejs.org/build/three.js"></script> <script> "use strict"; var logdiv, level=0; window.onload = function() { logdiv = document.getElementById("logdiv"); var geometry = new THREE.PlaneGeometry(2,3); var material = new THREE.MeshBasicMaterial(); var mesh = new THREE.Mesh(geometry, material); doit(1, mesh); return; } function doit(level, obj) { z_log("level "+level+", obj type is " + typeof obj); // print level and obj type z_log("level "+level, JSON.stringify(obj)); // print JSON.., but error if (obj == null) return; // recurse until obj == null doit(level+1, Object.getPrototypeOf(obj)); // recurse } function z_log(args) { // like console.log var s = ""; for (var i=0; i<arguments.length; i+=1) { s += ((i>0) ? ", " : "") + arguments[i]; } logdiv.innerHTML += s + "<br /><br />\n"; } </script> </head> <body> <div id="logdiv"></div> </body> </html>