I looked at all the other threads that had this problem, tried there solutions and nothing worked for me. I imported an animation from blender and it works perfect in the scene composer. In my code, i have:
Spatial an = model.getChild(“2”);
control = an.getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
The child named 2 is the parent of the AnimControl in the scene composer hierarchy. My hierarchy is baseNode > Armature > LeftArm > 1 > 2 > Geometry, Skeleton and AnimControl. For some reason control is null no matter what I try.
Yes, if you see them in the SDK you apparently access them wrong in your code. Maybe you try to get it from the root of the model while its actually attached to a child or so.
@normen said:
Yes, if you see them in the SDK you apparently access them wrong in your code. Maybe you try to get it from the root of the model while its actually attached to a child or so.
That is what I originally thought. However, I accessed the lowest child node to get the animation and still null. The parent of the animControl is "2" so I do, getChild("2").getControl.... There's honestly nothing else I can think of that could be wrong. I'll try using different children to see if the SDK might be displaying the location incorrectly
@pspeed said:
can you show a screen shot of the scene explorer tree showing where your anim control is?
I finally figured the problem. I animated one model and got the anim control in my class, but I created multiple classes in my world each with a different model with no animation so those are the ones that were now, I am having an issue with the kinematic rag doll. I got the ogre character to work but my own rigged model gets a NPE when I attach the control. The bones and everything exported fine.
@kamran said:
When you do Node.getChild(0) it is getting the first child of that node, when you do Node.getChild(1) then you will get the second child of the node assuming the node have two children for example lets say this is the hierarchy of a scene:
Node1
-Node2
–Node3
—AnimControl
If I would do Node1.getChild(0) then I would get Node2 which does not contain the AnimControl but If i do ((Node)Node1.getChild(0)).getChild(0) then I am going to get Node3 which contains the AnimControl. When I do Node1.getChild(“Node3”) then it is going to return the first child node with the name Node3. I hope that helps
Hop on in that thread and give him some props for that nice explanation. Because I was doing it wrong too.
Of course I’m only assuming you’re making the same mistake I made with the getChild(int)