I don’t really understand what do you mean but this is what I did `
final Spatial arm=assetManager.loadModel("Models/cyton_gamma_300/cyton_gamma_300.j3o");
final Material armMaterial=assetManager.loadMaterial("Materials/cyton_gamma_300.j3m");
arm.setMaterial(armMaterial);
Node armNode=new Node("Cyton Gamma 300");
armNode.attachChild(arm);
rootNode.attachChild(armNode);`
okay, so first open it in the scene editor. If the scene explorer window is not open, you can open it by going into window - SceneExplorer. There should be a list off to the left with material, AnimControl, and SkeletonControl underneath the object node.
Expand SkeletonControl, and you’ll see a list of all the bones that your model contain. The getskeleton().getBone(“String Bone”) takes one of the bones in the SkeletonControl as a String argument.
so your command would look like
Bone arm1 = ((SkeletonControl)arm.getControl(SkeletonControl.class)).getSkeleton().getBone("name of bone");
Something is going wrong and it’s getting me sick!!! I think that’s because I have 8 xml mesh files! and so 8 xml skeleton files! one skeleton file for each mesh file. But I got just one scene file and that’s the only one I can convert to j3o model.
I don’t know what to do
help please
Alternative: since you seem to want the parts completely separate and try to bypass normal bone-style animation wherever possible… don’t use bone animation. Treat every part as the separate spatial it is and then just parent them appropriately in the scene graph such that each joint can be rotated as expected.
Bone animation is really meant for cases where you are deforming a mesh. You don’t seem to be doing that here.
EUH… If I may ask (I don’t even khnow if I can continue asking in this thread or I should create another one) But couple of weird things are happening…
After groupping the robot elements to one mesh and creating the armature I got, as usual, a .xml mesh file, a .xml skeleton file and a .material file. I’m following some of the official tutorials (which are greate by the way) to get the arm moving and here things got a little bit strange:
1- when I import the .xml mesh file and attach it to the rootNode I don’t get the Light (which’s also created and added to the root node
DirectionalLight sun=new DirectionalLight();
sun.setDirection(new Vector3f(-0.5f, -0.5f, -0.5f).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
final Spatial arm=assetManager.loadModel("Models/cyton_gamma_300/ID732.mesh.xml");
final Material armMaterial=assetManager.loadMaterial("Materials/cyton_gamma_300.j3m");
arm.setMaterial(armMaterial);
Node armNode=new Node("Cyton Gamma 300");
armNode.attachChild(arm);
rootNode.attachChild(armNode);
the result is a little bit visible but there is no light in the appropriate direction
then, when I get one of the bones and set the user control to true like this `
the actuator attached to this bone has actually new location and the model looks messy. And if I remove the line
wristRollBone.setUserControl(true);
the model get perfect and all meshes are in the correct positions.
2- I decided to convert the porject to j3o project and import it
final Spatial arm=assetManager.loadModel("Models/cyton_gamma_300/cyton_gamma_300.j3o");
final Material armMaterial=assetManager.loadMaterial("Materials/cyton_gamma_300.j3m");
arm.setMaterial(armMaterial);
I got the lignt perfectely oriented to the appropriate direction, but I have no Skeleton data I tried to get the SkeletonControl from the .xml file and attached it to .j3o model but I can’t control the bones or at least the control are not visible.
Am I missing something here???
Well, actually I was able to solve the problem, I could make my interactive 3D model and I’m pretty happy with the result.
Than you very much for your help, @pspeed@Mechanatrix@Ali_RS@aegroto and @mathiasj nothing of this could be done without your help. And by the way… I love this community