Jump to content

Animation hook get called at the start


Andy90
 Share

Go to solution Solved by Josh,

Recommended Posts

 

Hello :) i try the new animation hooks. Right now the hook get triggert all the time at the start. 

void ReloadWeaponHook(shared_ptr<Skeleton> skeleton, shared_ptr<Object> extra) {
    auto weaponComponent = extra->As<Weapon>();
    if (weaponComponent != nullptr) {
        auto model = weaponComponent->GetEntity()->As<Model>();
        weaponComponent->EndReload();
        Print("Done");
    }
}
bool Weapon::CreateHooks()
{
    auto model = this->GetEntity()->As<Model>();
    int position = model->FindAnimation("Armature|17 Reload");
    if (position != -1) {
        int animationLength = model->CountAnimationFrames(position);
        model->skeleton->AddHook(position, animationLength, ReloadWeaponHook, this->As<Weapon>());
        return true;
    }
    
    return false;
}

Done is getting writen after he starts the animation

Link to comment
Share on other sites

  • 4 weeks later...
  • Solution

Animation hooks system has been revised in 0.9.7. I believe this is solved.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...