I’ve added a simple method to AnimControl in case you want to add additional meshes that should be controlled by the skeleton. Useful for clothing, that is added in run time, for example.
One caveat, though:
I’ve only gotten it to work on ogre meshes that have an AnimControl (ie a skeleton object exported with the model) as they’re converted to j3o, which i’ve then deleted in the SceneComposer. I don’t see why it has to be like that.
[java]
public void addMesh(Mesh mesh){
Mesh[] newTargets = new Mesh[targets.length+1];
System.arraycopy(targets, 0, newTargets, 0, targets.length);
newTargets[newTargets.length-1] = mesh;
targets = newTargets;
reset();
}
[/java]
Since AnimControl was split, SkeletonControl has now been updated with this method, instead:
[patch]
Index: SkeletonControl.java
===================================================================
— SkeletonControl.java (revision 7877)
+++ SkeletonControl.java (working copy)
@@ -382,4 +382,12 @@
}
skeleton = (Skeleton) in.readSavable("skeleton", null);
}
+
- public void addMesh(Mesh mesh){
-
Mesh[] newTargets = new Mesh[targets.length+1];<br />
-
System.arraycopy(targets, 0, newTargets, 0, targets.length);<br />
-
newTargets[newTargets.length-1] = mesh;<br />
-
targets = newTargets;<br />
-
resetToBind();<br />
- }
}
[/patch]
Edit: Please note that this is a local change. Someone with commit rights needs to submit it (or you can apply the patch locally as well)
hi i am interested in this, maybe it will allow me to add animation to my symmetric mesh that i generate :
http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/symmetry-mirror-modifer-uv-transformations/
This method will simply allow the added mesh to be deformed by the existing skeleton. It seems (to me), what you need is to duplicate part of the skeleton and mirror it, as well.
- well for the first part i will be happy if it just got deformed, better something than absolutely nothing.
E.g i can always mirror the skeleton in 3d studio max and import it. So this will be a good first solution.
- for the second part i can implement mirror skeleton, it wont be hard.