我想做一个能拖动的元素,意外得知可以用MouseJoint,但按照样例自己做的没反应为什么?而且没发现MouseJoint这个组件
onLoad () {
let joint = this.node.addComponent(cc.MouseJoint);
joint.mouseRegion = this.node;
}
不能控制元素移动为什么啊?还差什么么?
还要加一句:node.parent = this.node;
let node = new cc.Node();
let body = node.addComponent(cc.RigidBody);
body.type = cc.RigidBodyType.Static;
let joint = node.addComponent(cc.MouseJoint);
joint.mouseRegion = this.node;
node.parent = this.node;
大神只要加上这个就可以了吗?