ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Current Animation
person icon
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'
};

person icon
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);


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

Cool, thanks, works great this way!


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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