Search the Community
Showing results for tags 'transformnode'.
-
Hi, I use TransformNode as parent for my meshes and would like to add all children to ShadowGenerator, like this `addShadowCaster(node, true)` but it accepts just AbstractMesh as input there, what about changing type to TransformNode ? Like this: public addShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap) { return this; } if (!this._shadowMap.renderList) { this._shadowMap.renderList = []; } // Need to check if is real mesh if (mesh instanceof AbstractMesh) { this._shadowMap.renderList.push(mesh); } if (includeDescendants) { this._shadowMap.renderList.push(...mesh.getChildMeshes()); } return this; } for `removeShadowCaster` similar public removeShadowCaster(mesh: TransformNode, includeDescendants = true): ShadowGenerator { if (!this._shadowMap || !this._shadowMap.renderList) { return this; } // check if real mesh if (mesh instanceof AbstractMesh) { var index = this._shadowMap.renderList.indexOf(mesh); if (index !== -1) { this._shadowMap.renderList.splice(index, 1); } } if (includeDescendants) { // use getChildMeshes instead of getChildren to support nested TransformNodes for (var child of mesh.getChildMeshes(true)) { this.removeShadowCaster(<any>child); } } return this; } Any objections on this ? I haven't tested / profiled change impact so its just an idea now Would like to hear feedback, as maybe I am missing something here
-
Hi, is it possible to link a gui control, like the one in this example https://www.babylonjs-playground.com/#XCPP9Y#20, to a TransformNode, instead of a mesh? Thanks