Character and equipment – ANIMATION FOR MANY NODES USING ONLY 1 SKELETON

Yea, it shouldnt be hard to make a method that sets your helmets position and rotation to be the same as the bones position and rotation, running that method every update would “fake” and attachment

1 Like

thanks u people :slight_smile: beer for all! 8)



it dont work, it still have 0.0, 0.0, 0.0 for bone position, but nevermind, i will just do list of positions for parts of body :slight_smile:

you will write an additional file with the position of all parts and bones, because jme is bugged ? and what about animation ? do we have to create than by hand as well ?



Hope some developer reply’s because i now have the same problem and cannot use my 3d models !!!

I’ve read about your case in which: " You want your character model can interchange its equipments ,weapons or clothes"… ???


If it's true I think your solution is NOT a good one:
1.You modeled your character in ONE blender file then export the "the main character and each of its equipment" in a several parts in Ogre XML Format.
2. The equipments have the same skeleton with the main character so you want to use this skeleton for the equipment animation too.
3. Next, in JME, you complain that the engine re-pos the equipment to the [0,0,0] or you have to do the animation sync your self!
Oh, let me tell you, it has to do soo... ! :p
Let me explain and give you a NICE method to do what you need in my POV:
1. Think about what if your character is SIMPLE ... Which means "Your character and its equipments, clothes, hair, weapon and what ever is ONE-big mesh only" . You got them in several nodes, so all what you can and have to do is "hide - make invisible" what you don't want to see. That's true! If they isn't visible, their animation is ignore too !!! So what you need it a list of equipment parts and the node name which can be interchange with each other. It's simple , isn't it? <- Some old engine or "small" game did so...
2. If your character is too complex, your have to model the part separately ... Time for a tweak in your pipeline, the model and also the export part!!! In my game company, we do it like this :
- We model the equipment and the character in separated file and then export in separated file too <- this is good for some artists can work in a same complex character.
- The equipment like clothes ... which "bend" with the body, MUST have the same bone structure - and animation like the character ! <- This is for the animation sync which I don't know why in your opinion is BAD ???? (Big file ? Slow down the game... NO, man, it's NOT!)
- The equipment like hat, helmet, weapon, ... which just "attach" with the body, they are modeled and played with the same bone BUT just in the modeler application ... In the export time , we export them with some text file which is the list of equipments part and the bone they are interchangeable with each others. In our game, the show-hide job work on the equipment model like in option 1, NOT the main character! And then the two character is sync ! <- This is the sacrifice for the flexibility !
- The equipment like tail ... yes, it can be a cloth which left behind or a ponytail (no physic apply ) can have the different bone and animation and then "attach" to the head or the torso !
In brief : "YOU HAVE TO DO IT BY HAND !! " :p ..........or just write some python script man !
  1. You propose to export the character as a single mesh with all possible body parts/ equipment. But if everything is a single mesh how will i “Select” what to hide ? Any code example ?
  2. i didnt understand what you did different from option 1 ?
  3. At the end you proposed me to write an additional jme exporter because the current cant export model position ? sorry i dont know anything about blender scripts so i cant do that.

Sorry , I didn’t speak that clearly …

1.

The job : Make a list (XML) of interchangeable parts for each model :

  • Node name ,
  • Type : helmet , shock , sword , etc…
  • Which bones are their attach - able into ? ( Like sword can attach into the hip , the hand , the tosto , the back , all of them? and their local pos/ rot / scale in that parent , ussually (0,0,0) ).
  • The part is the current , the default or not?

    The code : I don’t have it cause I do it in another engine sorry, but I don’t think it’s hard :

    * Control the equip: Write a java class in JME to visible/hide one part at a time so they don’t appear like a mess! In JME : write a Control named it EquipControl , load the XML of equip and maybe visible only default part of a type (One helmet at a time).

    [java] addControl(Control control)

    Add a control to the list of controls.[/java]

    * Visible a node in JME : in the document , read them plz !!!

    [java] setCullHint(Spatial.CullHint hint)

    setCullHint sets how scene culling should work on this spatial during drawing.[/java]

    * Change your cloth: You play the animation of changing clothes of your character , Then you can setCullHint to hide a node which you don’t want to see, or can detach it from a visible parent node and then attach again when need (prepare a list of which equip belong to who and its path from the root Node !!!)

    [java] removeFromParent()

    removeFromParent removes this Spatial from it’s parent.[/java]

    * You don’t ask but : when you want to drop a sword, remove it from its parent and then attach to the ground or the rootNode and let the physic do the animation…

    2 .

    The NICE method i’m talk about is to separate your character-the cloth and the equip in 3 different models (in modeler application) and then add them to one playerNode in 3 subNode in JME. Then sync the animation of the cloth with the same bone structure ( can be a little bit simpler bone) , attach the equip to the specific bone and your job is done!

    Why you have to do that : cause it’s easier to do so in the modeler application and you can’t ask the engine to know everything!!!
  1. At the end you proposed me to write an additional jme exporter because the current cant export model position ? sorry i dont know anything about blender scripts so i cant do that.

    No the exporter CAN DO … or i really misunderstand something terriblely man!

for the question 2, I still think I wasn’t clear enough in the answer cause English is not my native voice so sorry :

Why we have to do the model separately ???



In the modeler application, you can copy or merge the mesh, the bone and the animation of bones with same structure … So can make a copy of one skeleton like a piece of cake … But you CAN’T do so in a engine such as this one JME :stuck_out_tongue: ( till now ?) …

-

In some most advanced engine, it’s possible … We can make it possible here too by writing some advanced java class :stuck_out_tongue: ← But IMO it takes sometime and make our game slow …

-

The idea of loading the models of character , clothes , equipments of one “player” separately is annoying at first but it’s turn out the best solution for us in our game company for some MMORPG. A player is one “thing” is the idea just in our mind, it’s in fact a combination of a lot of things exist in game world so it’s natural that it’s separated !

  1. ok the issue with this method is that if i export everything in 1 file then everything is imported without children (child count = 0) and when i try to hide a part everything becames invisible. Does that make sense ?



    I should look at the exporter code, maybe i will write my own exporter…
1 Like
tralala said:
1) ok the issue with this method is that if i export everything in 1 file then everything is imported without children (child count = 0) and when i try to hide a part everything becames invisible. Does that make sense ?

I should look at the exporter code, maybe i will write my own exporter...


That 's really make sense !

Sorry , I don't know that issue and may be the core team will take a look at that issue if they see this topic ?

The blender exporter totally ignores positions, i mean that if i move my models the exported file will have the exact same contents (checked with diff).



Here is my work around :

  1. export model to 3d studio max.
  2. put models in desired position (at least here it works)
  3. make everything 1 mesh with Attach button. put different materials so blender can “understand as many objects”
  4. import in blender. Options : Sepate objects by Object / group / material.
  5. You now have many objects, export each in a seperate file.
  6. Profit !



    Tell me if it works

ohh people, everything work fine if i do crtl-a and first option in blender, and then in code i have manual(via xml or function) position for object.

Then All animations work fine

About hide and show elements: There will be too many of elements to do it

BTW: separately model is better becouse i can do intime diffrent scale, rotation, local location(created by me), material, etc

atomix is right :slight_smile:

1 Like

@oxplay2: Thanks for your kind word , good new that the exporter work like expected … I will definitely check the method that @tralala told in his post …