Creating parent nodes in bender and accessing them in babylon.js

Hello, I’m very new to babylon. while I found that this is a very kind and helpfull comunity I was not able to find a solution to my problem, so I hope someone can point me in the right direction.

I have a 3d model composed of a lot of small meshes. I want to keep them as individual meshes, but to make it easier to asign attributes etc. I want to use a hierarchical structure, so I can just call the Parent nodes.

I tried to use collections in blender, but that did not work. I also found this topic, but that does not help either:
helpfull topic
This is how it looks in blender:
grafik

In the Sandbox it looks like this:
grafik

Calling

var collectionMuscle = scene.getMeshByName(“A_Parent”);

apparently it is not found. calling one of the individual meshes the if condition is true (then it fails because it has no children)

So I’m compleatly clouless what I’m missing. Pointing in the right direction would be appriciated.
Here is the code. I’m sorry I could not upload the data somewhere to build a playground.

  const musclecolor = new BABYLON.StandardMaterial("musclecolor");
  musclecolor.diffuseColor = new BABYLON.Color3(0.38824, 0.09020, 0.02745);
    BABYLON.SceneLoader.ImportMeshAsync(
  	"",
  	"http://127.0.0.1:8080/marma/resources/",
  	"knochen_muskel_v4.glb"
  ).then((result) => {
  	console.log("imported")
  	result.meshes.forEach((mesh) => {
  		// Apply scaling
  		const scalingFactor = 0.08; //
  		mesh.scaling = new BABYLON.Vector3(scalingFactor, scalingFactor, scalingFactor);
  		console.log("aligned")
  	});
  	console.log("test")
  	// Access muscles
  	var collectionMuscle = scene.getMeshByName("A_Parent");
  	// Set apperance of muscles
  	if (collectionMuscle) {
  		console.log("Set apperance of muscles")
  		collectionMuscle.getChildren().forEach(function (mesh) {
  			mesh.material.alpha = 0.5; // Set opacity to 50%
  			mesh.material = musclecolor; // Apply color
  		});	
  	}
  });

Welcome abroad!
A_Parent is a transformNode rather than a abstractMesh, you may use scene.getTransformNodeByName instead of scene.getMeshByName.
As the doc says:

A TransformNode is an object that is not rendered but can be used as a center of transformation.

3 Likes

Thank you very much!

Feel a little bit stupid now, could not grasp what a TransitionNode is.