Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Checking if 3d animation is playing problem

Author
Message
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Apr 2023 03:16
So I am lost or my coding is not correct. What is wrong with my code? I am trying to set a attack anim and am using GetObjectIsAnimating() and it does not work. Is there a better way to check if my attack animation is over to go back to my regular anim?

The author of this post has marked a post as an answer.

Go to answer

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 18th Apr 2023 06:19
you could try stopobjectanimation(objid) before playing the object animation


SetObjectAnimationFrame(UINT objID, animName, time, tweentime )
should work better for setting the animation to a start frame
fubarpk
https://fubarpk.itch.io/
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Apr 2023 13:52 Edited at: 18th Apr 2023 13:56
limited 3D experience but i don't see a GetObjectPlaying() command which is odd.

a quick test shows that if the object is not currently playing an animation, GetObjectAnimationTime(objID) will return 0.0?
i've monitored but not sure what "or if the animation has stopped then the last time used for interpolation is returned." actually means.
i think that's refering to the built-in tween time but unsure.

otherwise, you could probably track and compare GetObjectBoneX() on a bone that should be moving, as well.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Apr 2023 14:01
This post has been marked by the post author as the answer.
GetObjectIsAnimating is the default code for is it playing. There is no getobjectplaying and getobjectanimationtime just records the time it started playing but I did figure this out guys and thank you.

I guess in AppGameKit you do not need to stop a animation to start a new one so just playing the attack anim with no flag works.


Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 19th Apr 2023 08:57
Hi

In the doc, we can see the starttime and endtime of playerObjectAnimation() is in second, not in frame.

Your time value seems very big : (walk back for example)
Quote: "PlayObjectAnimation(player,"",596,620,1,0.1)"


Your animation has 620 seconds ?

If you use frame instead of second for playObjectAnimation(), you should try to change it in second.

Your attack animation doesn't use a loop, so GetObjectIsAnimating() should work when the animation of attack is finished.

(I have tried and it work with my model.)
AGK2 tier1 - http://www.dracaena-studio.com
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Apr 2023 18:44
Blendman Hi

I am using stock models to set this up so the animations are what they are for now.

Yes like I said for animations to play in AppGameKit I learned you do not need a flag they just play over each other and as long as you reset each flag after the attack anim it works.

Thank you for helping.

Login to post a reply

Server time is: 2024-04-20 01:40:02
Your offset time is: 2024-04-20 01:40:02