[]请问LayaAirUnityPlugin 1.1.0.unitypackage导出的.lsani文件怎么使用?
用目前最新的导出工具导出的动画,运行时报如下错误:
运行环境为:
windows7 64位
layabox 1.7.5
chrome 59.0.3071.86
附上unitypackage资源
以下为加载代码,请问这样使用是否正确:
class ShuiPao extends Sprite3D {
constructor() {
super();
let mesh = Sprite3D.load('resources/shuipao.lh');
this.addChild(mesh);
mesh.on(Event.HIERARCHY_LOADED, this, this.OnHierarchyLoaded);
let ani_names = this.ani_names;
let anies = this.anies;
for (let name in ani_names) {
anies[name] = AnimationTemplet.load(ani_names[name]);
}
}
private ani_names = {
idle: 'resources/Assets/ArtResources/Models/Shuipao/Animation/WaterCannon_idle-Idle.lsani',
attack: 'resources/Assets/ArtResources/Models/Shuipao/Animation/WaterCannon_attack-Attack.lsani',
};
private anies : {[name:string]:AnimationTemplet} = {};
private meshes : Array<MeshSprite3D> = [];
private OnHierarchyLoaded() {
for (let v of this._childs[0]._childs) {
let mesh = v as MeshSprite3D;
mesh.addComponent(SkinAnimations);
this.meshes.push(mesh);
}
this.switchAnimation('idle');
}
private switchAnimation(name:string) {
console.log('switchAnimation: ' + this.meshes.length);
let anitemplet = this.anies[name];
for (let mesh of this.meshes) {
let ani = mesh.getComponentByType(SkinAnimations, 0) as SkinAnimations;
ani.templet = anitemplet;
ani.player.play();
}
}
}
运行环境为:
windows7 64位
layabox 1.7.5
chrome 59.0.3071.86
附上unitypackage资源
以下为加载代码,请问这样使用是否正确:
class ShuiPao extends Sprite3D {
constructor() {
super();
let mesh = Sprite3D.load('resources/shuipao.lh');
this.addChild(mesh);
mesh.on(Event.HIERARCHY_LOADED, this, this.OnHierarchyLoaded);
let ani_names = this.ani_names;
let anies = this.anies;
for (let name in ani_names) {
anies[name] = AnimationTemplet.load(ani_names[name]);
}
}
private ani_names = {
idle: 'resources/Assets/ArtResources/Models/Shuipao/Animation/WaterCannon_idle-Idle.lsani',
attack: 'resources/Assets/ArtResources/Models/Shuipao/Animation/WaterCannon_attack-Attack.lsani',
};
private anies : {[name:string]:AnimationTemplet} = {};
private meshes : Array<MeshSprite3D> = [];
private OnHierarchyLoaded() {
for (let v of this._childs[0]._childs) {
let mesh = v as MeshSprite3D;
mesh.addComponent(SkinAnimations);
this.meshes.push(mesh);
}
this.switchAnimation('idle');
}
private switchAnimation(name:string) {
console.log('switchAnimation: ' + this.meshes.length);
let anitemplet = this.anies[name];
for (let mesh of this.meshes) {
let ani = mesh.getComponentByType(SkinAnimations, 0) as SkinAnimations;
ani.templet = anitemplet;
ani.player.play();
}
}
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
183*****755
赞同来自:
动画问题:请使用 官方最新版LayaAir1.76 工具请使用LayaUnityPlugin1.1.1
最近很太忙了,你先自己查下,麻烦了,如果还有问题,应该就是引擎的bug,继续留帖,我帮你查。
辛苦辛苦。。。