Project

General

Profile

« Previous | Next » 

Revision c7c83fb7

Added by Leszek Koltunski almost 3 years ago

TwistyObject's ObejctScreenRatio and InitScreenRatio shouldn't be static. Make them non-static.
Otherwise, if the current object is, say, a cube (initSR=0.5), we fire up tutorials and start a tutorial for something with vastly different ObjectScreenRatio (Jing- initSR=1.64), then come back to the Main Activity - so there's a cube on the screen again - the ratios stay at their Jing values, which screws up detection of rotations.

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
234 234
        Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat);
235 235
        Static4D rotatedCamera= QuatHelper.rotateVectorByInvertedQuat(CAMERA_POINT, mQuat);
236 236

  
237
        if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera) )
237
        if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera,object.getObjectRatio() ) )
238 238
          {
239 239
          mDragging           = false;
240 240
          mContinuingRotation = false;
......
394 394

  
395 395
      Static4D touchPoint2 = new Static4D(x, y, 0, 0);
396 396
      Static4D rotatedTouchPoint2= QuatHelper.rotateVectorByInvertedQuat(touchPoint2, mQuat);
397
      Static2D res = mMovement.newRotation(numLayers,rotatedTouchPoint2);
397
      Static2D res = mMovement.newRotation(numLayers,rotatedTouchPoint2,object.getObjectRatio());
398 398

  
399 399
      mCurrentAxis = (int)res.get0();
400 400
      mCurrentRow  = (int)res.get1();

Also available in: Unified diff