[]如何动态添加Animator和加载AnimationClip并播放
1,不在unity中创建和导出Animator和controler,只导出lm和lsani
2,如何在h5中动态加载lm和lsani并播放动画?
下面的代码实现不了:
var layaScene:Sprite3D = scene.addChild(Sprite3D.load("res/LayaScene/layaScene.lh")) as Sprite3D;
layaScene.once(Event.HIERARCHY_LOADED, this, function():void{
var meshSprite:Sprite3D=layaScene.getChildAt(0) as Sprite3D;
var animator:Animator = meshSprite.addComponent(Animator) as Animator;
var clip:AnimationClip=AnimationClip.load("res/LayaScene/Assets/unit/Unit_1111-A101.lsani");
animator.addClip(clip,"attack");
animator.play("attack");
});
2,如何在h5中动态加载lm和lsani并播放动画?
下面的代码实现不了:
var layaScene:Sprite3D = scene.addChild(Sprite3D.load("res/LayaScene/layaScene.lh")) as Sprite3D;
layaScene.once(Event.HIERARCHY_LOADED, this, function():void{
var meshSprite:Sprite3D=layaScene.getChildAt(0) as Sprite3D;
var animator:Animator = meshSprite.addComponent(Animator) as Animator;
var clip:AnimationClip=AnimationClip.load("res/LayaScene/Assets/unit/Unit_1111-A101.lsani");
animator.addClip(clip,"attack");
animator.play("attack");
});
没有找到相关结果
已邀请:
要回复问题请先登录
2 个回复
Aar0n
赞同来自:
https://ldc.layabox.com/doc/?nav=zh-as-4-1-0
文档有项目例子教程的
linxuyang
赞同来自:
不能在h5动态创建这些吗?