File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var Class = require('../../utils/Class');
33var Composite = require ( './lib/body/Composite' ) ;
44var Constraint = require ( './lib/constraint/Constraint' ) ;
55var Detector = require ( './lib/collision/Detector' ) ;
6+ var GetFastValue = require ( '../../utils/object/GetFastValue' ) ;
67var Merge = require ( '../../utils/object/Merge' ) ;
78var Sleeping = require ( './lib/core/Sleeping' ) ;
89var Vertices = require ( './lib/geometry/Vertices' ) ;
@@ -35,6 +36,19 @@ var PointerConstraint = new Class({
3536
3637 this . world = world ;
3738
39+ var camera = GetFastValue ( options , 'camera' , null ) ;
40+
41+ if ( ! camera )
42+ {
43+ this . camera = scene . sys . cameras . main ;
44+ }
45+ else
46+ {
47+ this . camera = camera ;
48+
49+ delete options . camera ;
50+ }
51+
3852 this . pointer = null ;
3953
4054 this . active = true ;
@@ -109,7 +123,8 @@ var PointerConstraint = new Class({
109123 }
110124 else
111125 {
112- var position = pointer . position ;
126+ // var position = this.camera.screenToCamera({ x: pointer.position.x, y: pointer.position.y });
127+ var position = this . pointer . positionToCamera ( this . camera ) ;
113128
114129 if ( constraint . bodyB )
115130 {
You can’t perform that action at this time.
0 commit comments