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/tutorials/TutorialSurfaceView.java
206 206
      Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat);
207 207
      Static4D rotatedCamera= QuatHelper.rotateVectorByInvertedQuat(CAMERA_POINT, mQuat);
208 208

  
209
      if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera) )
209
      if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera,object.getObjectRatio()) )
210 210
        {
211 211
        mDragging           = false;
212 212
        mContinuingRotation = false;
......
339 339

  
340 340
      Static4D touchPoint2 = new Static4D(x, y, 0, 0);
341 341
      Static4D rotatedTouchPoint2= QuatHelper.rotateVectorByInvertedQuat(touchPoint2, mQuat);
342
      Static2D res = mMovement.newRotation(numLayers,rotatedTouchPoint2);
342
      Static2D res = mMovement.newRotation(numLayers,rotatedTouchPoint2,object.getObjectRatio());
343 343

  
344 344
      mCurrentAxis = (int)res.get0();
345 345
      mCurrentRow  = (int)res.get1();

Also available in: Unified diff