(sorry for double post, I cannot edit my other thread :/)
@navycougar said:
Hello guys,
I created an animated character, exported to JME, removed the geometries by detleting the “material_26 child” saved the file to rig.j3o
then removed the animCOntrol and SkelletonControl from my character
and the animations don’t work, I can see the models, but they don’t move
have I done anything wrong?
I saved the generated rig file with the binary exporter and opened it in the scenecomposer, the animations don’t work
here’s how my j3o look like:
yes they work but i’m not sure if my bone hierarchy is right, or if I really understand what nehon said,
in blender do we have to make 1 .blend with ALL the geometries attached to the rig? or can we use different.blend files?
u’ll find a screen of my screen composer at bottom.
t0neg0d nehon said you can, and I am following what he said:
@nehon said:
I would :
- create a rig in blender and make some animations.
- create all my models using this exact same rig.
- export the first model to JME
- turn it into a j3o, you should have a node with and animControl and a skeletonControl and the model geometry(ies) attached to it.
- remove the geometrie and save the file : this is you rig file.
- export every single model
- for each model torn it to j3M, remove the AnimControl and SkeletonControl from them and only keep the geoms.
in code, load de rig.j3o, then load one model, add the geometries from the model to the root Node of the rig.j3o file.
This should work, target geometries will be automatically gathered by the skeleton control and providing you used the exact same rig, pieces should get together.
yes they work but i’m not sure if my bone hierarchy is right, or if I really understand what nehon said,
in blender do we have to make 1 .blend with ALL the geometries attached to the rig? or can we use different.blend files?
u’ll find a screen of my screen composer at bottom.
t0neg0d nehon said you can, and I am following what he said:
I think you are misinterpreting what he said.
You are destroying the animation control (containing the animation info). The vertex groups are gone when you do this, reattaching them to the rig in JME will do nothing if the vertex groups are gone.
Actually… I am… not u… but this will not work, because what he said is wrong lol
EDIT: The reason I say this is… a mesh has absolutely ZERO information pertaining to keyframed bone animations associated with it. It knows NOTHING about vertex groups… so if the geom was attached to multiple bones and you destroy the anim control… how could it possibly know what to associate itself with?
@navycougar said:
@t0neg0d
someone made it work with @nehon help here is the topic :
http://hub.jmonkeyengine.org/forum/topic/animations-for-same-skeleton-different-objects-blender-question/#post-236738
nehon implies that he made a fix in the nightly build…(i’m using RC2)
This line from the OP makes me think the clothing is attached to single bones:
“Now I can create a file have single Armature and parent to it the character and all the clothes…”
Um… ok… wait one second… the rig might contain a list of meshes… soooo… have you checked the rig to make sure that removing the geometries didn’t destroy these references (if there are these references)?
@t0neg0d said:
Um... ok... wait one second... the rig might contain a list of meshes... soooo... have you checked the rig to make sure that removing the geometries didn't destroy these references (if there are these references)?
well actually there is something weird in what @nehon says, he said :
remove the geometrie and save the file : this is you rig file.
export every single model
for each model torn it to j3M, remove the AnimControl and SkeletonControl from them and only keep the geoms.
this is the weird part, he says turn the model to j3M? (maybe he means keep only the material)
I don’t see any references in my rig that’s why I started the thread I wish someone could shed light on this , I posted a screenshot of my scene editors with the rig, and my original spatial.
@t0neg0d said:
What happens if you combine them in the scene composer and select the anim control then select one of the animations from the drop down?
Does it work there?
yeah, well, in order to see the actually generated j3o, I used the binary exporter to save it to a j3o:
[java]
BinaryExporter exporter = BinaryExporter.getInstance();
File file = new File(“C:/game/assets/Models/”+“MyModel.j3o”);
try {
exporter.save(rig, file);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, “Error: Failed to save game!”, ex);
}
[/java]
and opened the generated file in the scene editor, and the animations don’t work there…
meaning that the references have been lost??
look at the image I posted earlier, I show the result rig
The thing that I found strange is, why would you have to export anything other than the original mesh with the armatures/animations, if you are going to remove this after the fact.
I would think as long as they were attached when the first model was exported, the reference in the rig to that mesh would be there… (I really don’t think these references are store there though). Then you could just export the model - animations and save a TON of time exorting crap you dont need.
Anyways… I hope to god I am wrong. I wanted to do this as well, and couldn’t find a way that worked.
EDIT: I keep looking at the image (I mean I have been multiple times making sure I saw what I thought I saw).
I see the compined output contains the anim control with the two animations listed. But the meshes don’t recognize the rig, because there animation controls were destoryed in the process.
Hopefully @nehon can explain how this can work (if it can)…
@t0neg0d said:
The thing that I found strange is, why would you have to export anything other than the original mesh with the armatures/animations, if you are going to remove this after the fact.
I would think as long as they were attached when the first model was exported, the reference in the rig to that mesh would be there… (I really don’t think these references are store there though). Then you could just export the model - animations and save a TON of time exorting crap you dont need.
Anyways… I hope to god I am wrong. I wanted to do this as well, and couldn’t find a way that worked.
EDIT: I keep looking at the image (I mean I have been multiple times making sure I saw what I thought I saw).
I see the compined output contains the anim control with the two animations listed. But the meshes don’t recognize the rig, because there animation controls were destoryed in the process.
Hopefully @nehon can explain how this can work (if it can)…
tonegod, I made it work, by moving the model by hand and saving the generated file again.
so it means that it really works, I rmemeber the other guy said something about resetting the rig in order to make it work, i’ll try that. (but I just made it work by resaving the j3o by hand)
@navycougar said:
tonegod, I made it work, by moving the model by hand and saving the generated file again.
so it means that it really works, I rmemeber the other guy said something about resetting the rig in order to make it work, i’ll try that. (but I just made it work by resaving the j3o by hand)
O.o I am soooo going to have a go at this tomorrow! This has been the biggest bane of my gaming existence.
@navycougar said:
Yess i confirm that it works when I move the materials out of those root_attachnode folder and save the j3oby hand
I just combined the hair and the body saved the file by hand and the animation works.
I wonder if it is possible to attach them differently (i.e. by code) That would be ideal, but if this means I can export all my equipment etc without animations… that will be good enough for me.
I sabed the generated rig file with binary exporter, in the default setup it doesn’t work, but when I move the material_26 ad material_29 out of the root_attachmentnode folder, and resave the file, my hair and my model start MOVINg! OMG!!!
this proves that the references are still there, its just a matter of updaing the rig…
bbut how to refresh it in code??
the leo used this :
@The Leo said:
mehehe thanks, finally got it to working. Inside the SkeletonControl the Mesh[] targets wasnt updated. So in the easiest way i needed to call just about this
rig.getControl(SkeletonControl.class).setSpatial(null);
rig.getControl(SkeletonControl.class).setSpatial(rig);
Now it works XD
but this doesnt work in my case because I have to move the material_26 and material_29 to the root of the rig…
you can attach a geometry to a bone by getting the attachement node on this bone and attach the geometry to it. The effect is that the geometry’s transforms will “copy” the bone transforms. That’s convenient for a sword attached to a hand or even a helmet to a head.
Now, for parts like legs and chest the rig has to deform the mesh not only transform it.
When you export from ogre a rigged character sub-graph is made of a node on which all the character geometries are attached. The AnimControl and the SkeletonControl are set on the Node and not on the sub geoms.
The skeleton control has to know what geometry to deform, so in RC2 when you set the SkeletonControl to the node (node.addControl(skeletonControl)) the geometries from the node sub graph are recursively gathered.
So in RC2, if you change a sub geometry you have to go
[java]
SkeletonControl ctrl = node.getControl(SkeletonControl.class);
node.removeControl(ctrl);
node.addControl(ctrl);
[/java]
Then the sub geoms will be refreshed.
In 3.0, geoms are refreshed on every frame, so you don’t need this and it just works.
When i said “trun your models to J3M”, I meant J3o yes, that was a mistake.
Hope that’s clear to you, and that I answered all your questions.