.B3D: How to make character body out of several parts
-
- Posts: 105
- Joined: Mon Jun 02, 2014 2:32 am
- Location: Washington, D.C.
- Contact:
Re: .B3D: How to make character body out of several parts
@Mel
Everything you just said is what I figured I'd have to end up doing. :/
Would you mind telling me which classes I should look into in order to implement this approach?
Thanks.
Everything you just said is what I figured I'd have to end up doing. :/
Would you mind telling me which classes I should look into in order to implement this approach?
Thanks.
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
Re: .B3D: How to make character body out of several parts
@Mel
Edit: I misunderstood you, at first. Is it necessary for the "all animations" file to even have a mesh. Could it just be the skeleton?
Either way, I'm still trying to get useAnimationFrom to even work.
Edit: I misunderstood you, at first. Is it necessary for the "all animations" file to even have a mesh. Could it just be the skeleton?
Either way, I'm still trying to get useAnimationFrom to even work.
Re: .B3D: How to make character body out of several parts
@Alopex: You can split animations nodes from mesh nodes on export. So the animations don't need Texture Nodes, Brush Nodes and Mesh Nodes while the base mesh doesn't need animation nodes.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: .B3D: How to make character body out of several parts
@CuteAlien
Edit: Had a brainfart. I'll get back to you once I emerge from my admittedly self-induced confusion.
Edit: Had a brainfart. I'll get back to you once I emerge from my admittedly self-induced confusion.
Re: .B3D: How to make character body out of several parts
Code: Select all
IAnimatedMesh* maletorsomesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Chest.b3d");
IAnimatedMesh* maleheadmesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Head.b3d");
IAnimatedMesh* malehandsmesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Hands.b3d");
IAnimatedMesh* malelegsmesh = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Legs.b3d");
IAnimatedMesh* malefeetmesh = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Feet.b3d");
IAnimatedMesh* anim = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Player_Animations.b3d"); //animated full-body mesh
ISkinnedMesh* skinmaletorsomesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmaleheadmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalehandsmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalelegsmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalefeetmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinanim = (ISkinnedMesh*) anim;
IAnimatedMeshSceneNode* maletorsonode = smgr->addAnimatedMeshSceneNode(maletorsomesh);
IAnimatedMeshSceneNode* maleheadnode = smgr->addAnimatedMeshSceneNode(maleheadmesh);
IAnimatedMeshSceneNode* malehandsnode = smgr->addAnimatedMeshSceneNode (malehandsmesh);
IAnimatedMeshSceneNode* malelegsnode = smgr->addAnimatedMeshSceneNode (malelegsmesh);
IAnimatedMeshSceneNode* malefeetnode = smgr->addAnimatedMeshSceneNode (malefeetmesh);
maletorsonode->setMaterialFlag(EMF_LIGHTING, false);
maleheadnode->setMaterialFlag (EMF_LIGHTING, false);
maleheadnode->setParent(maletorsonode);
malehandsnode->setMaterialFlag (EMF_LIGHTING, false);
malehandsnode->setParent (maletorsonode);
malelegsnode->setMaterialFlag (EMF_LIGHTING, false);
malelegsnode->setParent (maletorsonode);
malefeetnode->setMaterialFlag (EMF_LIGHTING, false);
malefeetnode->setParent (malelegsnode);
skinmaletorsomesh->useAnimationFrom(skinanim);
skinmaleheadmesh->useAnimationFrom(skinanim);
skinmalehandsmesh->useAnimationFrom(skinanim);
skinmalelegsmesh->useAnimationFrom(skinanim);
skinmalefeetmesh->useAnimationFrom(skinanim);
Last edited by Alopex on Sun Sep 20, 2015 10:56 pm, edited 2 times in total.
Re: .B3D: How to make character body out of several parts
Been a while since I worked with that stuff... maybe you have to use setFrameLoop to set the animation range in this case.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: .B3D: How to make character body out of several parts
Fair enough. But, I have tried creating a scene node for the animations (which just placed a new mesh in the same place as my other one) and also using setFrameLoop for each of the scene nodes (which did absolutely nothing, it seems).
Re: .B3D: How to make character body out of several parts
Sorry, no idea then without a test-case. It's something I would have to debug.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 105
- Joined: Mon Jun 02, 2014 2:32 am
- Location: Washington, D.C.
- Contact:
Re: .B3D: How to make character body out of several parts
@Alopex
I think your "anim" variable needs to be an IAnimatedMeshSceneNode... that's the only way you can get it to animate properly with the "setFrameLoop()" method. Then the child nodes can point to the ISkinnedMesh property of that particular node for each "useAnimationFrom()" method call.
I think your "anim" variable needs to be an IAnimatedMeshSceneNode... that's the only way you can get it to animate properly with the "setFrameLoop()" method. Then the child nodes can point to the ISkinnedMesh property of that particular node for each "useAnimationFrom()" method call.
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
Re: .B3D: How to make character body out of several parts
@SunnyStormy
I've implemented your suggestions, but something is still...off.
Result: My piece-by-piece character stands in a static pose while the mesh holding the animations goes through its loops. The animated mesh and the static mesh are in the same spot.
I've implemented your suggestions, but something is still...off.
Code: Select all
IAnimatedMesh* maletorsomesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Chest.b3d");
IAnimatedMesh* maleheadmesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Head.b3d");
IAnimatedMesh* malehandsmesh = smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Hands.b3d");
IAnimatedMesh* malelegsmesh = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Legs.b3d");
IAnimatedMesh* malefeetmesh = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Feet.b3d");
IAnimatedMesh* anim = smgr->getMesh ("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Player_Animations.b3d");
ISkinnedMesh* skinmaletorsomesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmaleheadmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalehandsmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalelegsmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinmalefeetmesh = (ISkinnedMesh*) maletorsomesh;
ISkinnedMesh* skinanim = (ISkinnedMesh*) anim;
IAnimatedMeshSceneNode* maletorsonode = smgr->addAnimatedMeshSceneNode(maletorsomesh);
IAnimatedMeshSceneNode* maleheadnode = smgr->addAnimatedMeshSceneNode(maleheadmesh);
IAnimatedMeshSceneNode* malehandsnode = smgr->addAnimatedMeshSceneNode (malehandsmesh);
IAnimatedMeshSceneNode* malelegsnode = smgr->addAnimatedMeshSceneNode (malelegsmesh);
IAnimatedMeshSceneNode* malefeetnode = smgr->addAnimatedMeshSceneNode (malefeetmesh);
IAnimatedMeshSceneNode* animnode= smgr->addAnimatedMeshSceneNode (anim);
maletorsonode->setMaterialFlag(EMF_LIGHTING, false);
maleheadnode->setMaterialFlag (EMF_LIGHTING, false);
maleheadnode->setParent(maletorsonode);
malehandsnode->setMaterialFlag (EMF_LIGHTING, false);
malehandsnode->setParent (maletorsonode);
malelegsnode->setMaterialFlag (EMF_LIGHTING, false);
malelegsnode->setParent (maletorsonode);
malefeetnode->setMaterialFlag (EMF_LIGHTING, false);
malefeetnode->setParent (malelegsnode);
animnode ->setFrameLoop(0,1262);
skinmaletorsomesh->useAnimationFrom(skinanim);
skinmaleheadmesh->useAnimationFrom(skinanim);
skinmalehandsmesh->useAnimationFrom(skinanim);
skinmalelegsmesh->useAnimationFrom(skinanim);
skinmalefeetmesh->useAnimationFrom(skinanim);
-
- Posts: 105
- Joined: Mon Jun 02, 2014 2:32 am
- Location: Washington, D.C.
- Contact:
Re: .B3D: How to make character body out of several parts
@Alopex
Do me a favor and comment everything out except for the mesh code that's supposed to be animated.
For example, try:
Just to check to make sure the animation is even working. Also, are you calling your "drawAll()" method from inside of an update loop? Those animations are dependent upon the ISceneManager being updated. If this works, we can take it step by step from here.
Do me a favor and comment everything out except for the mesh code that's supposed to be animated.
For example, try:
Code: Select all
IAnimatedMeshSceneNode* animnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Player_Animations.b3d"));
animnode->setLoopMode(true);
animnode->setFrameLoop(0,1262);
animnode->setAnimationSpeed(30);
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
Re: .B3D: How to make character body out of several parts
@SunnyStormy
I implemented your changes again. The animated mesh in animnode is doing exactly what it is supposed to.
Here is my device loop:
I implemented your changes again. The animated mesh in animnode is doing exactly what it is supposed to.
Here is my device loop:
Code: Select all
while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
-
- Posts: 105
- Joined: Mon Jun 02, 2014 2:32 am
- Location: Washington, D.C.
- Contact:
Re: .B3D: How to make character body out of several parts
Good!
Try this and let me know if it works:
Something along those lines... I think. >_>
Try this and let me know if it works:
Code: Select all
IAnimatedMeshSceneNode* animnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Player_Animations.b3d"));
animnode->setLoopMode(true);
animnode->setFrameLoop(0,1262);
animnode->setAnimationSpeed(30);
IAnimatedMeshSceneNode* maletorsonode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Chest.b3d"));
maletorsonode->getMesh()->useAnimationFrom(animNode->getMesh());
maletorsonode->setMaterialFlag(EMF_LIGHTING, false);
IAnimatedMeshSceneNode* maleheadnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Head.b3d"));
maleheadnode->getMesh()->useAnimationFrom(animNode->getMesh());
maleheadnode->setMaterialFlag(EMF_LIGHTING, false);
maleheadnode->setParent(maletorsonode);
IAnimatedMeshSceneNode* malehandsnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Hands.b3d"));
malehandsnode->getMesh()->useAnimationFrom(animNode->getMesh());
malehandsnode->setMaterialFlag(EMF_LIGHTING, false);
malehandsnode->setParent(maletorsonode);
IAnimatedMeshSceneNode* malelegsnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Legs.b3d"));
malelegsnode->getMesh()->useAnimationFrom(animNode->getMesh());
malelegsnode->setMaterialFlag(EMF_LIGHTING, false);
malelegsnode->setParent(maletorsonode);
IAnimatedMeshSceneNode* malefeetnode = smgr->addAnimatedMeshSceneNode(smgr->getMesh("C:/Users/James/Documents/Psychophagus/Assets/Male/Male_Feet.b3d"));
malefeetnode->getMesh()->useAnimationFrom(animNode->getMesh());
malefeetnode->setMaterialFlag(EMF_LIGHTING, false);
malefeetnode->setParent(malelegsnode);
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
Re: .B3D: How to make character body out of several parts
Returns 5 errors trying to build.
||=== Build: Debug in Psychophagus (compiler: GNU GCC Compiler) ===|
C:\Users\James\Documents\Psychophagus\main.cpp||In function 'int main(int, char**)':|
C:\Users\James\Documents\Psychophagus\main.cpp|55|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|59|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|64|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|69|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|74|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
||=== Build: Debug in Psychophagus (compiler: GNU GCC Compiler) ===|
C:\Users\James\Documents\Psychophagus\main.cpp||In function 'int main(int, char**)':|
C:\Users\James\Documents\Psychophagus\main.cpp|55|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|59|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|64|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|69|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
C:\Users\James\Documents\Psychophagus\main.cpp|74|error: 'class irr::scene::IAnimatedMesh' has no member named 'useAnimationFrom'|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
-
- Posts: 105
- Joined: Mon Jun 02, 2014 2:32 am
- Location: Washington, D.C.
- Contact:
Re: .B3D: How to make character body out of several parts
@Alopex
Hmm... you may need to actually split the "useAnimationFrom()" line into two separate statements. One where you grab the mesh and typecast it to ISkinnedMesh, and another where you point to the animation of "animnode".
I'm wondering, though, if that's even necessary? Try only setting the children nodes (and not grabbing the animation of the "animnode"), and see if anything happens. I'm wondering if there's some redundancy here...
Hmm... you may need to actually split the "useAnimationFrom()" line into two separate statements. One where you grab the mesh and typecast it to ISkinnedMesh, and another where you point to the animation of "animnode".
I'm wondering, though, if that's even necessary? Try only setting the children nodes (and not grabbing the animation of the "animnode"), and see if anything happens. I'm wondering if there's some redundancy here...
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"