[solved] how to add sub-mesh or remove sub-mesh on the fly?

Problems building or running the engine, queries about how to use features etc.
BumbleBee
Gnoblar
Posts: 2
Joined: Thu Aug 21, 2008 2:57 am

[solved] how to add sub-mesh or remove sub-mesh on the fly?

Post by BumbleBee »

hi everybody,

besides body mesh itself, characters usually have more skinned object like boots, gown etc, these armory stuff use same skeleton as the body mesh, but they are removable and add-able, i searched the Entity and Mesh interfaces and no luck : it looks there is no interface like 'Entity::addSubMesh' or 'Mesh::addSubMesh' available there, so how to add sub-mesh or remove sub-mesh dynamiclly while runing?

thank you very much.
Last edited by BumbleBee on Thu Aug 21, 2008 9:52 am, edited 1 time in total.
BumbleBee
Gnoblar
Posts: 2
Joined: Thu Aug 21, 2008 2:57 am

Post by BumbleBee »

ok, i've figured it out (and the link http://www.ogre3d.org/phpBB2/viewtopic.php?t=43727 proved my thoughts on this)

Code: Select all

    // attach one
    Entity *ent = SceneManager::createEntity(...)
    node->attachObject(ent);

    // attach another one
    ent = SceneManager::createEntity(...)
    node->attachObject(ent)
 
    ....
    // remove one of the mesh (entity) loaded
    sceneNode->detachObject(theEntityToBeDeatched);
    ...