public GVRSceneObject startDrag ( GVRSceneObject dragMe , float relX , float relY , float relZ ) { synchronized ( mLock ) { if ( mCursorController == null ) { Log . w ( TAG , "Physics drag failed: Cursor controller not found!" ) ; return null ; } if ( mDragMe != null ) { Log . w ( TAG , "Physics drag failed: Previous drag wasn't finished!" ) ; return null ; } if ( mPivotObject == null ) { mPivotObject = onCreatePivotObject ( mContext ) ; } mDragMe = dragMe ; GVRTransform t = dragMe . getTransform ( ) ; /* It is not possible to drag a rigid body directly, we need a pivot object. We are using the pivot object's position as pivot of the dragging's physics constraint. */ mPivotObject . getTransform ( ) . setPosition ( t . getPositionX ( ) + relX , t . getPositionY ( ) + relY , t . getPositionZ ( ) + relZ ) ; mCursorController . startDrag ( mPivotObject ) ; } return mPivotObject ; }
Start the drag of the pivot object .