Killer.Penguin Posted February 4, 2014 Share Posted February 4, 2014 The following script seems to not be blending two animations for us: mesh.setLayer(0); mesh.setAnimation(xxx); mesh.setWeight(0.5); mesh.setLayer(1); mesh.setAnimation(yyy); mesh.setWeight(0.5); Do I need to apply setBuffer to get it working? Link to comment
silent Posted February 6, 2014 Share Posted February 6, 2014 Hi, Sorry, can't reproduce such behavior. Could you please sent us minimal test scene? Also, please check interpolation between two animation layer sample: samples/animation/animation_01. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Killer.Penguin Posted February 6, 2014 Author Share Posted February 6, 2014 Well here's the whole thing: public: void playAnimation(string nAnimation, float nBlend) { if (animation_current != nAnimation) { animation_current = nAnimation; if (animations.check(nAnimation)) { mesh.setLayer(0); string oldAnimation = mesh.getAnimation(); float oldFrame = mesh.getFrame(); mesh.setAnimation(animations[nAnimation]); mesh.setFrame(-1); mesh.setSpeed(30); mesh.setLoop(1); if (mesh.isStopped()) mesh.play(); mesh.setLayer(1); mesh.setAnimation(oldAnimation); mesh.setFrame(oldFrame, -1, -1); mesh.setSpeed(30); mesh.setLoop(1); if (mesh.isStopped()) mesh.play(); animation_blendTime = nBlend; animation_blendTimer = 0; } else log.message ("Warning: animation " + nAnimation + " not found \n"); } } private: void updateAnimation(float dt) { if (animation_blendTimer < animation_blendTime) { animation_blendTimer = clamp(animation_blendTimer + dt, 0.0f, animation_blendTime); float nBlendWeight = lerp(0.0f, 1.0f, animation_blendTimer/animation_blendTime); mesh.setLayer(0); mesh.setWeight(nBlendWeight); mesh.setLayer(1); mesh.setWeight(1.0f-nBlendWeight); } } ps. In general, I found that animation that's not currently active (from setLayer(x)) refuse to play. Link to comment
silent Posted February 6, 2014 Share Posted February 6, 2014 Hi, Thanks for the script, but it's really hard to say what part of this code causing such behavior, sorry. It would be more efficient to all of us if you can sent us simple test scene with your *.world, *.cpp, *.smesh and animation files. Thank you! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Killer.Penguin Posted February 6, 2014 Author Share Posted February 6, 2014 What email should I send it to? ps. Is it possible that there's some other parameter that set the animation to use only one layer? Link to comment
binstream Posted February 6, 2014 Share Posted February 6, 2014 engine-support@unigine.com Link to comment
silent Posted February 6, 2014 Share Posted February 6, 2014 Hi, You can send scene directly to the engine-support@unigine.com. Function mesh.setNumLayers() is used to set the number of animation layers directly. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Killer.Penguin Posted February 6, 2014 Author Share Posted February 6, 2014 Well I did use setNumLayers() to set it to 2 layers and double check it with getNumLayers(), everything seems to be correct, but the animation is just not blending. If I can't clear this by tomorrow, I'll try to recreate a sample test scene for it. Link to comment
unclebob Posted March 6, 2014 Share Posted March 6, 2014 Hi! Looks like I'm doing some necroposting here but I'm curious is everything ok with that issue? Have you managed to get setWeight code working? Can I close that topic as solved? Link to comment
Killer.Penguin Posted March 7, 2014 Author Share Posted March 7, 2014 No, it's not. If you would please look at the project we sent you, you can un-hide all our test blend weight stuff in "scripts/Character.h" to see how it doesn't work... Link to comment
unclebob Posted March 18, 2014 Share Posted March 18, 2014 Hi Warit, I think I found source of the problem. You can't just set animations and call ObjectMeshSkinned::play, you have to call ObjectMeshSkinned::setFrame for each layer instead. If you look at samples/animation/animation_01 you can notice that code (i've cleaned it up a little bit): float time = engine.game.getTime(); mesh.setLayer(0); mesh.setFrame(time); mesh.setWeight(weight); mesh.setLayer(1); mesh.setFrame(time); mesh.setWeight(1.0f - weight); Link to comment
Killer.Penguin Posted March 20, 2014 Author Share Posted March 20, 2014 Hmmm ok... in order to use animation layers, I have to use setFrame updating each layer every frame? Link to comment
Recommended Posts