[SOLVED] playing animations on the fly and physics on the skeleton

Started by elhoce, February 29, 2012, 07:21:42 PM

Previous topic - Next topic

elhoce

Hi,

I'm coding a live wallpaper with skeleton animations, but I have some memory problems (out of memory exception), I understood why. The file. bone is a serialized Java object that contains all the animations, my set of animations is too big to be loaded into memory. So is there a way to read and play through a data stream, a keyframe or set a keyframe on the fly? if so what classes should I use?

I have another question, I added some physics stuff on some bones in my skeleton (dynamic hair motion), it works perfectly, but I changed the SkeletonPose class adding my physical stuff to make it work . I would move my code in my own package, especially in order to not re-edit the library for each future updates, so what classes should I use to move joints during an animation?

Thank you for your help :)

raft

no, there is no such streaming support at the moment and possibly will never be. indeed i would be surprised if it's the animation data itself which doesnt fit into memory. it should be really really big animation data.

i'm not sure I understood your second question. if you change any part of Bones's code, you would possibly need to re-edit them after each update. i cannot see any escape from that

elhoce

thank you for your quick reply,

In others words I want to write a class which read & play a set of keyframes but I'm not found an example  who explain how it works.
So what objects in your library i would need to use in order to load a bunch of keyframes.

For my second question this is the same I want to know if there is a way outside of the Skeleton pose to move a joint during an animation.

Sorry I'm french so my english is not very well.

raft

how big is your bones file? i really suspect it's animation data itself that doesnt fit into memory.

anyway, if you really need streaming, one possible way that comes to mind is, save each SkinClip into a different file and load and play them one by one. that's not trivial but I guess it can be done.

for your second question, you need to somehow apply animation to SkeletonPose. but you can do that programatically. have a look at ProceduralAnimationSample.

elhoce

Hi,
my bones file takes 12MB with 3200 keyframes. My skeleton have 112 joints...

I have another question, is it possible to animate keyframe per keyframe in other word my set of animation is stored in a whole animation in the xml ogre, so I want to play a bunch of keyframes within the whole animation example start 10 to 30, then 300 to 330 etc... your function animatedGroup.animateSkin(index, sequence); takes the parameter index that I'can't understand cuz index += deltaTime * animationSpeed / clipTime / 1000; so where is the link with the keyframe ?

Thanks.

raft

time of keyframe is also stored in animation files. so there is no need to mention about key frame in animateSkin(index, sequence) method. index is a number in 0-1 range and is applied according to length of all sequence

I guess you can implement what you think, but it requires a bit more understanding of inner workings of Bones

raft

do you really need that much keyframes? you can lower density, for example: 2 keyframes per second instead of 5.

other than that you can break all sequence into pieces and load and play them one by one. not a real streaming but a quick solution