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); };
琥珀君的博客

浙公网安备 33010602011771号