Andy90 Posted June 24 Share Posted June 24 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 Quote Link to comment Share on other sites More sharing options...
Andy90 Posted June 24 Author Share Posted June 24 int animationLength = model->CountAnimationFrames(position) -2; gives the actual last frame Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted July 18 Solution Share Posted July 18 Animation hooks system has been revised in 0.9.7. I believe this is solved. Quote 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 More sharing options...
Recommended Posts
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.