IAnimatedMesh named animations

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I think it's probably too complex to be exposed in the public API, newbie-unfriendly enough due to the generics etc, but I see no reason why something like this (without the exceptions) couldn't be used behind the scenes to do all sorts of interpolation.

I guess we'd need quite a few changes to ISkinnedMesh to accommodate it, but I don't see that being too much of a problem.

Here's what I've decided on for the IAnimatedMesh changes:
http://pastebin.com/fmgqZLwT

I can't see any obvious incompatibilities there, and I think my idea still seems reasonably sensible even if we did use generic animators. Please feel free to suggest changes before I take the plunge and start editing all the implementations though!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

bitplane wrote: I guess we'd need quite a few changes to ISkinnedMesh to accommodate it, but I don't see that being too much of a problem.
Agreed, there's still much work to be done before determining if something like this would be right for Irrlicht.
bitplane wrote:Here's what I've decided on for the IAnimatedMesh changes
+1 from me.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Yeah, +1 from me too. It looks awesome so far. I set mine up with chaining by the way. When the animation finishes, it automatically plays the next animation if it exists. That might be something nice to add.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please use u32 for timeInMilliseconds and levelOfDetail. There's no reason why we would want to use floats here. There are no fractions of milliseconds in Irrlicht, and level of detail is an artificial number anyway. But it makes computations so much simpler.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I figured that we'd need a float in case someone ran an animation very slowly, they'd get jerky playback with unsigned ints. Also, they may want to reverse the animation by messing with the clock.

However, coming to implement this in SAnimatedMesh I realise that you're completely right. It adds far too much complexity for the benefit of a couple of corner cases, I'll change it to u32.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Something that would be really nice is root bone motion. If the root bone is moved in the animation, then the scene node's position would be updated also. And if we had that it would also be nice to have callback that gets the position that the scene node was going to be moved to; so that the positioning could be overriden if we needed to also reposition physics objects, or cameras.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
fmx

Post by fmx »

many models have more than one animated root when imported into irrlicht's as a skinnedmesh, I spotted this issue with a couple of characters I bought online.
Irrlicht's skinning system allows for multiple roots although practically speaking, setting a single root is a trivial reorganization process during loading and there is no need for more than one root

morph target animations should be separate and parallel to skinning animation, so both can be controlled and applied depending on the project requirements;
ie, for MD2 skinned-animation isn't needed and for B3D morph-animations aren't, yet both animation methods should be available simultaneously instead of having two distinct node types

Though i'm happy with my custom animated model setup, I will keep a close eye on this topic anyways :wink:
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Has any coding been done for this? If not, I have a patch that implements the interface bitplane described here:

http://pastebin.com/fmgqZLwT

Using the existing IAnimatedMeshSceneNode interface, running a named animation would look something like this:

Code: Select all

scene::IAnimatedMeshSceneNode* animatedNode;
scene::IAnimatedMesh* animatedMesh;
io::IAttributes* animationData;
s32 index;

animatedMesh = animatedNode->getMesh();
if((index = animatedMesh->getAnimationIndex("walk")) >= 0)
{
    animatedMesh->getAnimation(index, animationData);
    s32 start = animationData->getAttributeAsInt("startFrame");
    s32 end = animationData->getAttributeAsInt("endFrame");
    animatedNode->setFrameLoop(start, end);
}
Given that, I'm thinking an IAnimatedMeshSceneNode update would make using named animations a bit easier:

Code: Select all

bool IAnimatedMeshSceneNode::setAnimation(const c8* name);
bool IAnimatedMeshSceneNode::setAnimation(const io::IAttributes* data);
bool IAnimatedMeshSceneNode::getAnimation(const c8* name, io::IAttributes* data); 
Thoughts?
Post Reply