Hi,
I cannot figure out how the non bone based (frame by frame transformations) work.
I have this as reference, but the AnimationState ‘state’ variable returns NULL.
Node* modelNode = scene_->CreateChild("myAnim");
modelNode->SetPosition(Vector3(260.0f, 110.0f, 260.0f));
AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>();
modelObject->SetModel(cache->GetResource<Model>("Models/my.mdl"));
// walkAnimation is non null
Animation* walkAnimation = cache->GetResource<Animation>("Models/my_Global.ani");
// this below is always NULL
AnimationState* state = modelObject->AddAnimationState(walkAnimation);
// The state would fail to create (return null) if the animation was not found
if (state)
{
// Enable full blending weight and looping
state->SetWeight(1.0f);
state->SetLooped(true);
state->SetTime(Random(walkAnimation->GetLength()));
} else {
// NULL here
}
So there must be something wrong with ‘modelObject’.
This works with bone animation, so does anyone know the correct steps?
grokko