Skip to content

Commit edb2993

Browse files
authored
Improved
1 parent 01686f0 commit edb2993

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/js/controls/DragControls.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
8989

9090
var object = intersects[ 0 ].object;
9191

92-
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), object.getWorldPosition( _worldPosition ) );
92+
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
9393

9494
if ( _hovered !== object ) {
9595

@@ -129,7 +129,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
129129

130130
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
131131

132-
_offset.copy( _intersection ).sub( _selected.getWorldPosition( _worldPosition ));
132+
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
133133

134134
}
135135

@@ -204,11 +204,11 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
204204

205205
_selected = intersects[ 0 ].object;
206206

207-
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _selected.getWorldPosition( _worldPosition ) );
207+
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
208208

209209
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
210210

211-
_offset.copy( _intersection ).sub( _selected.getWorldPosition( _worldPosition ) );
211+
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
212212

213213
}
214214

0 commit comments

Comments
 (0)