I am using following api to play the animation, but I don’t want the animation to loop.
this.entity.anim.baseLayer.transition(‘dead’, 0.2);
https://developer.playcanvas.com/en/api/pc.AnimComponentLayer.html#transition
I am using following api to play the animation, but I don’t want the animation to loop.
this.entity.anim.baseLayer.transition(‘dead’, 0.2);
https://developer.playcanvas.com/en/api/pc.AnimComponentLayer.html#transition
I have coded as follows,
for (var i = 0; i < this.animationAssets.length; ++i) {
var animationAsset = this.animationAssets[i];
if(animationAsset.stateName == "dead" || animationAsset.stateName == "crouch")
this.entity.anim.assignAnimation(animationAsset.stateName, animationAsset.asset.resource, false);
else
this.entity.anim.assignAnimation(animationAsset.stateName, animationAsset.asset.resource);
}
Made the following changes, it is working now.
this.entity.anim.assignAnimation(animationAsset.stateName, animationAsset.asset.resource, 'Base', 1, false);
Just to wrap this up, the transitions are not responsible for the looping of animation states. The transitions control moving from one state to another. The state is responsible for looping.