Hi, folks!)
I create some like a boom fx, and when i turn away from it, and i turn to it again - boom fx have something like a lag or phase shift in animation.
Why is this happening? and how to solve this?
[video]http://youtu.be/vrf38AYw1qM[/video]
this my code for animation if it needed
void ScriptBoom::Start()
{
ResourceCache* cache = GetSubsystem<ResourceCache>();
material_ = cache->GetResource<Material>("Materials/MT_Boom.xml");
ringNode_ = GetNode()->GetChild("boomRing",true);
// AlphaMask Factor
factorAnim_ = SharedPtr<ValueAnimation>(new ValueAnimation(context_));
//srand(0);
float noise = Random(0.1f, 0.5f);
float lag = Random(-0.5f, 0.5f);
factorAnim_->SetKeyFrame(0.0f, 0.5f);
factorAnim_->SetKeyFrame(0.5f, 1.3f);
factorAnim_->SetKeyFrame(1.0f, 2.0f);
material_->SetShaderParameterAnimation("Factor", factorAnim_);
// Scale
scaleAnim_ = SharedPtr<ValueAnimation>(new ValueAnimation(context_));
float startSize = 0.1f;
float endSize = 8.0f;
scaleAnim_->SetKeyFrame(0.0f, Vector3(startSize, startSize, startSize));
scaleAnim_->SetKeyFrame(0.5f, Vector3(endSize, endSize, endSize));
scaleAnim_->SetKeyFrame(1.0f, Vector3(startSize, startSize, startSize));
GetNode()->SetScale(startSize);
GetNode()->SetAttributeAnimation("Scale", scaleAnim_, WM_LOOP);
//light
light_ = GetNode()->GetComponent<Light>();
lightAnim_ = SharedPtr<ValueAnimation>(new ValueAnimation(context_));
lightAnim_->SetKeyFrame(0.0f, 0.0f);
lightAnim_->SetKeyFrame(0.5f, 10.0f);
lightAnim_->SetKeyFrame(1.0f, 0.0f);
light_->SetAttributeAnimation("Brightness Multiplier", lightAnim_);
// ring
ringMaterial_ = cache->GetResource<Material>("Materials/MT_BoomRing.xml");
ringAlphaAnim_ = SharedPtr<ValueAnimation>(new ValueAnimation(context_));
ringAlphaAnim_->SetKeyFrame(0.0f, Vector4(1.0f,1.0f,1.0f,0.0f));
ringAlphaAnim_->SetKeyFrame(0.5f, Vector4(1.0f,1.0f,1.0f,2.0f));
ringAlphaAnim_->SetKeyFrame(0.7f, Vector4(1.0f,1.0f,1.0f,0.5f));
ringAlphaAnim_->SetKeyFrame(1.0f, Vector4(1.0f,1.0f,1.0f,0.0f));
ringMaterial_->SetShaderParameterAnimation("MatDiffColor", ringAlphaAnim_);
}