From 0101ff31375bc78a8df98f339f46bdf75dc37532 Mon Sep 17 00:00:00 2001 From: 2youyouo2 <501251991@qq.com> Date: Tue, 27 Jun 2017 10:12:21 +0800 Subject: [PATCH] fixed mouse joint --- cocos2d/core/physics/joint/CCMouseJoint.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/physics/joint/CCMouseJoint.js b/cocos2d/core/physics/joint/CCMouseJoint.js index 6516e1c432..ad6bb3e7b4 100644 --- a/cocos2d/core/physics/joint/CCMouseJoint.js +++ b/cocos2d/core/physics/joint/CCMouseJoint.js @@ -259,9 +259,16 @@ var MouseJoint = cc.Class({ }, update: function () { - if (cc.Camera && cc.Camera.main && this._pressPoint) { + if (!this._pressPoint) { + return; + } + + if (cc.Camera && cc.Camera.main) { this.target = cc.Camera.main.getCameraToWorldPoint(this._pressPoint); } + else { + this.target = this._pressPoint; + } } });