ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperLicht
Current Animation
Author Text

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: "Internation?l" (you are not logged in)


Text:

 

  

Forum 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


   





Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.