PlayCanvas_0010:模型元自身坐标轴旋转脚本

1,

 

 

var Rotate = pc.createScript('rotate');

Rotate.attributes.add('speed',{
    type: 'number',
    default: 2
});

Rotate.prototype.initialize = function(){
    
    this.on('enable', function(){
        console.log('Enabled');
    });
    
    this.on('disable', function(){
        console.log('Disable');
    });
    
};

Rotate.prototype.update = function(dt){
    this.entity.rotateLocal(0, this.speed * dt, 0);
    
};

 

posted @ 2021-06-16 11:58  琥珀君  阅读(199)  评论(0编辑  收藏  举报