var po = touch.getLocation()
var centerPoint = cc.p(cc.winSize.width>>1, cc.winSize.height>>1)
//--
var o = po.x-sp1.x
var a = po.y-sp1.y
var at = Math.atan(o / a) * 180 / Math.PI
if (a < 0) {
if (o < 0)
at = 180 + Math.abs(at);
else
at = 180 - Math.abs(at);
}
at-= 90 //物体初始是水平摆放
var centerPoint = cc.p(cc.winSize.width>>1, cc.winSize.height>>1)
//--
var o = po.x-sp1.x
var a = po.y-sp1.y
var at = Math.atan(o / a) * 180 / Math.PI
if (a < 0) {
if (o < 0)
at = 180 + Math.abs(at);
else
at = 180 - Math.abs(at);
}
at-= 90 //物体初始是水平摆放
sp1.runAction(cc.rotateTo(1, at))
//--------------------------2---------------------------------
onLoad: function () {
this.main.on(cc.Node.EventType.TOUCH_START, this.changeHandRotate.bind(this))
},
changeHandRotate:function (params) {
var po1 = this.hand.getPosition()
po1 = this.main.convertToWorldSpaceAR(po1)
po1 = cc.pSub(params.getLocation(), po1)
var at = cc.radiansToDegrees(cc.pAngleSigned(po1, cc.p(0,1)))
this.hand.rotation = at
}