DragonBones代码控制Bone执行Action

onLoad:
var _armatureDisplay = this.getComponent(dragonBones.ArmatureDisplay);
this.ddc_luntai2 = _armatureDisplay.armature().getBone(“ddc_luntai2”);

update :
if (CC_JSB)
{
this.ddc_luntai2.offset.setRotation(this.angle * Math.PI/180);
}
else
{
this.ddc_luntai2.offset.rotation = this.angle * Math.PI/180;
}

发现ddc_luntai2根本不能旋转。

DragonBones 在egret里可以直接修改bone角度 但在creator 需要用到混合动画 可以参考 creator exmple 里的那个机器人是如何跟随鼠标转动头部的

1赞

好的,谢谢!:kissing_heart:

有人知道dragbone的透明度怎么修改吗

【自己回复一个】

写一个逻辑组件,挂载在Creator的游戏对象上

// 组件加载时调用
onLoad: function () {
    // 获取骨骼动画组件对象
    var _armatureDisplay = this.getComponent(dragonBones.ArmatureDisplay);
    // 修改骨骼组件显示的armature
    _armatureDisplay.armatureName = "ddc";
    
    // ddc_luntai2  ddc_luntai1
    // 获取轮子的骨头对象
    this.ddc_luntai2 = _armatureDisplay.armature().getBone("ddc_luntai2");
    
    // 定义一个角度初始值
    this.angle = 1;
},

// 游戏运行的每一帧调用
update: function (dt) {
    // 角度证件
    this.angle = this.angle + 1;
    

    if (CC_JSB)
    {
        // 在原生平台上
        this.ddc_luntai2.offset.setRotation(this.angle * Math.PI/180);
    }
    else
    {
        // 在h5(web)平台上
        this.ddc_luntai2.offset.rotation = this.angle * Math.PI/180;
    }
    
    // 刷新显示
    this.getComponent(dragonBones.ArmatureDisplay).armature().invalidUpdate();
},