Jump to content

imported meshes and parents


Davin
 Share

Recommended Posts

so i've blown the last few days, so i thought, perfecting the MH->blender->makewalk->babylon sequence.... The main question gets messy and confusing, but first i'll try to explain what i'm doing so far.

I've got my animations figured out, and i've extracted them on a bone by bone basis.... I've then applied them pragmatically to other [model].babylon that share the same bone structure... working well! Although --- i have questions on this, there must be a better way to do this.  not the main issue

I thought i was golden, animations play pretty well....  until i got to moving meshes... for hours i was puzzled trying to figure out why avi's were not moving, until i realized just the eyes were moving... further research led me to realize that the whole "parent" structure was missing

so my main question is.... what IS the correct parent->child structure for an imported mesh?  Is is something i can reconstruct pragmatically?  or do i need to go fix somethign in blender?  (ultimately the .babylon files will go away, as customization will be saved in serialized objects... but not quite there yet)

as a secondary question... is there a better way to deal with these animations?   for example... several different imported meshes (with the same bone structure of course) will share the same animations... I've been toying with an animation serializer / deserializer, but i dont quite have that working yet.

 

Link to comment
Share on other sites

I've worked out a solution --- I'll make mention of it here in case  its useful for anyone else:

So i never really found a good way to automatically add a parent node in blender, and i wanted to make the the whole makehuman->blender->babylon process as simple as possible, as i hope to incorporate some help building out avatars and animations...

as I'm already pre-processing .babylon files on the server, this seems to be working out just fine :

php code:

        if (!isset($avi->meshes[1]->parentId)){
            array_unshift($avi->meshes, array('name'=>$name, 'id'=>$name, 'position'=>[0,0,0], 'rotation'=>[0,0,0], 'scaling'=>[1,1,1], visibility=>1, 'skeletonId'=>'-1', 'isEnabled'=>true));
            for ($i = 1; $i < count($avi->meshes); $i++){
                $avi->meshes[$i]->parentId = $name;
            }
        }

 

which basically pops a minimalist mesh at the top of the stack, and parents everything else to it.  Animations still seem to be happy, and the world is good!  Not the most graceful work around, but it works!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...