Author Topic: How to implement dressing?  (Read 1665 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
How to implement dressing?
« on: December 07, 2012, 05:45:39 am »
I have a dog(Animated3D), i want to dress it with different decors. For example: hat、shoes、clothes and so on. And the decors should animate with the dog.

How to implement this?

There is my first ideal:

1, Build dog model and hat model.
2, Make dog-bones-animation and hat-bones-animation.
3, export dog.bones and hat.bones.
4, animate dog.bones and hat.bones.

That's workable. But i think that the hat's animation is just relying to the dog, so i want to build just an animated-dog, and a hat without animation-info(skinclips), let the hat share the skinclips with  the dog. If can do this, how? I tried, but didn't succeed:

1, In maya, build dog model and hat model, let them share the same skeleton.
2, Export dog.bones with full animations, export hat.bones with just 1 frame animations.
3, In code:
Code: [Select]
hat.replaceSkeleton(dog.getSkeleton()); 
hat.setSkinClipSequence(dog.getSkinClipSequence());

//render loop
playDogAnimation();
playHatAnimation();



Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to implement dressing?
« Reply #1 on: December 07, 2012, 03:28:00 pm »
in your editor, make dog, hat and others different objects and link them to same skeleton. so, when the skeleton is animated, all of the objects are deformed accordingly. then select all of your objects and export them.

this should create a skeleton file and a mesh file with many submeshes (dog, hat, etc). each submesh is converted into a different Animated3D in same AnimatedGroup. you can retrieve each Animated3D and show/hide it as required.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: How to implement dressing?
« Reply #2 on: December 08, 2012, 06:34:57 am »
Thanks! I have tried what you say and it works.

Another question:
I hope the hat will be changeable. Now i can change the texture. But how could i change the Mesh?

I can make a new hat model in editor which share the same skeleton with the old one, and i want to just export the new-hat.bones.

Now i have an old AnimatedGroup(Include many sub meshes, such as dog、hat、shoes and so on), a new-hat AnimatedGroup(Include only one mesh: new hat). How could i replace the old-hat-mesh in the old AnimatedGroup with the new-hat-mesh in the new AnimatedGroup?
« Last Edit: December 08, 2012, 06:37:42 am by kiffa »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to implement dressing?
« Reply #3 on: December 08, 2012, 06:44:44 am »
you can't do that replace at the moment. but there is a simpler solution. export both old hat and new hat with the group and show/hide the appropriate hat as required.

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: How to implement dressing?
« Reply #4 on: December 08, 2012, 07:31:19 am »
Yes, that's a solution. But there may be some problems: ram 、loading-time、update.

In my project, there will be many decors(10 hats、10 shoes、10 clothes ... etc). If i loading all of them in the same time, which may cause OOM. And it's hard to use small patch to update the decors(Must update all of the AnimatedGroup, not only the changed one).

I'am not familiar with skin-animations, if i want to do such replacing, what i needed to do?(replace Animated3D in AnimmatedGroup? replace MeshData and SkinData?)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to implement dressing?
« Reply #5 on: December 08, 2012, 07:51:21 am »
if objects arent very large, memory will not be such a problem IMHO. why noy just try it?

yes, in theory you can replace an Animated3D in a group.