怎样用摇杆控制prefab角色,新手求教

怎样用摇杆控制prefab角色,搜索到的所有案例都是直接把精灵直接放上去的,新手求教
比如这个案例
cc.Class({
extends: cc.Component,

properties: {
    dot: {
        default: null,
        type: cc.Node
    },
    ring: {
        default: null,
        type: cc.Node
    },
    player: {
        default: null,
        type: cc.Prefab,//这里改成了prefab
    },
    speed: 5,
    obj: {
        default: null 
    },
    isMove: false
},

onLoad() {
    this._initTouchEvent();
 
},



_initTouchEvent() {
    var self = this;
    self.dot.on('touchstart', function (event) {
        self._touchStartEvent(event);
    });
    self.dot.on('touchmove', function (event) {
        self._touchMoveEvent(event);
    });
    self.dot.on('touchend', function (event) {
        self._touchEndEvent(event);
    });
    self.dot.on('touchcancel', function (event) {
        self._touchEndEvent(event);
    });
},

_touchStartEvent(event) {
    // 以圆圈为坐标系获取触摸坐标
    var touchPos = this.ring.convertToNodeSpaceAR(event.currentTouch._point);
    // 更改摇杆的位置
    // var act = cc.moveTo(0.1, touchPos);
    // this.dot.runAction(act);
    this.dot.setPosition(touchPos);
    var obj = this.computeRotation(touchPos);
    this.isMove = true;
},

_touchMoveEvent(event) {
    var touchPos = this.ring.convertToNodeSpaceAR(event.currentTouch._point);
    var distance = cc.pDistance(touchPos, cc.p(0, 0));
    var radius = this.ring.width / 2;

    var obj = this.computeRotation(touchPos);
    if (distance < radius) {
        this.dot.setPosition(touchPos);
    } else {
        // 控杆永远保持在圈内,并在圈内跟随触摸更新角度
        var x = radius * Math.sin(obj.radian);
        var y = radius * Math.cos(obj.radian);
        if (touchPos.y > 0) {
            this.dot.setPosition(x, y);
        } else {
            this.dot.setPosition(-x, -y);
        }
    }
    this.isMove = true;
},

_touchEndEvent(event) {
    this.dot.setPosition(0, 0);
    this.isMove = false;
},

computeRotation(touchPos) {
    var obj = {}
    // 在 touchPos.y === 0,即水平轴时,会出现一个异常显示
    obj.radian = Math.atan(touchPos.x / touchPos.y);
    obj.rotation = (180 * obj.radian / Math.PI + 90) % 360;
    if (touchPos.y < 0) {
        obj.rotation = -obj.rotation;
    } else {
        obj.rotation = 180 - obj.rotation;
    }
    this.obj = obj;
    return obj;
},

moveDot(obj) {
    var player = this.player
    if (obj.rotation >= 0) {
        // 一、二象限
        this.player.x += this.speed * Math.sin(obj.radian);
        this.player.y += this.speed * Math.cos(obj.radian);
    } else {
        // 三、四象限
        this.player.x -= this.speed * Math.sin(obj.radian);
        this.player.y -= this.speed * Math.cos(obj.radian);
    }
},

update(dt) {
    if (this.isMove) {
        this.moveDot(this.obj);
    }
}

});

把prefab生成成节点,就和其他普通的节点没什么区别了啊,一样可以控制。那些控制精灵的也是控制节点的,this.xxx.x,this.xxx.y就是你生成的节点的x, y

**

受到你的启发,我查了下说明文档,总算搞懂了,十分感谢您的指导!还请以后多多指教!

**
说明文档内容:
创建预制节点

和克隆已有节点相似,你可以设置一个预制(Prefab)并通过 cc.instantiate 生成节点。使用方法如下:

cc.Class({
extends: cc.Component,

properties: {
target: {
default: null,
type: cc.Prefab,
},
},

start: function () {
var scene = cc.director.getScene();
var node = cc.instantiate(this.target);

node.parent = scene;
node.setPosition(0, 0);

},
});

我在场景中生成了一个节点,可是摇杆还是控制不了新生成的节点啊,是不是还要通过什么方法获取一下啊?