Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Current Animation

dex2015
Registered User
Quote
2015-04-08 19:23:49

Hi,

how can I get the current Anitmation name in the game cycle?

engine.OnAnimate = function() {
// Do something in the game cycle
var currentAnim = player.getCurrentAnimation();

console.log(currentAnim.name);

// Expose: 'walk' e.g.
// So I can play a footstep sound als long as the animation is 'walk'
};


erik
Registered User
Quote
2015-04-09 12:57:26

AFAIK, there is no simple function for this, but you can use getNamedAnimationRangeByName from the skinned mesh class to do this. Use code like this to see if currently the animation you want is playing (in my example, the animation "stand":

var range = animatedMeshNode.Mesh.getNamedAnimationRangeByName("stand");
var isPlaying = (range != null && animatedMeshNode.EndFrame == range.End && animatedMeshNode.StartFrame == range.Begin);



dex2015
Registered User
Quote
2015-04-09 19:32:24

Cool, thanks, works great this way!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact