public boolean startDrag ( final GVRSceneObject sceneObject , final float hitX , final float hitY , final float hitZ ) { final GVRRigidBody dragMe = ( GVRRigidBody ) sceneObject . getComponent ( GVRRigidBody . getComponentType ( ) ) ; if ( dragMe == null || dragMe . getSimulationType ( ) != GVRRigidBody . DYNAMIC || ! contains ( dragMe ) ) return false ; GVRTransform t = sceneObject . getTransform ( ) ; final Vector3f relPos = new Vector3f ( hitX , hitY , hitZ ) ; relPos . mul ( t . getScaleX ( ) , t . getScaleY ( ) , t . getScaleZ ( ) ) ; relPos . rotate ( new Quaternionf ( t . getRotationX ( ) , t . getRotationY ( ) , t . getRotationZ ( ) , t . getRotationW ( ) ) ) ; final GVRSceneObject pivotObject = mPhysicsDragger . startDrag ( sceneObject , relPos . x , relPos . y , relPos . z ) ; if ( pivotObject == null ) return false ; mPhysicsContext . runOnPhysicsThread ( new Runnable ( ) { @ Override public void run ( ) { mRigidBodyDragMe = dragMe ; NativePhysics3DWorld . startDrag ( getNative ( ) , pivotObject . getNative ( ) , dragMe . getNative ( ) , hitX , hitY , hitZ ) ; } } ) ; return true ; }
Start the drag operation of a scene object with a rigid body .