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/objects/Movement.java
250 250
// PUBLIC API
251 251
///////////////////////////////////////////////////////////////////////////////////////////////////
252 252

  
253
  public boolean faceTouched(Static4D rotatedTouchPoint, Static4D rotatedCamera)
253
  public boolean faceTouched(Static4D rotatedTouchPoint, Static4D rotatedCamera, float objectRatio)
254 254
    {
255
    float objectRatio = TwistyObject.getObjectRatio();
256

  
257 255
    mPoint[0]  = rotatedTouchPoint.get0()/objectRatio;
258 256
    mPoint[1]  = rotatedTouchPoint.get1()/objectRatio;
259 257
    mPoint[2]  = rotatedTouchPoint.get2()/objectRatio;
......
277 275

  
278 276
///////////////////////////////////////////////////////////////////////////////////////////////////
279 277

  
280
  public Static2D newRotation(int numLayers, Static4D rotatedTouchPoint)
278
  public Static2D newRotation(int numLayers, Static4D rotatedTouchPoint, float objectRatio)
281 279
    {
282
    float objectRatio = TwistyObject.getObjectRatio();
283

  
284 280
    mPoint[0] = rotatedTouchPoint.get0()/objectRatio;
285 281
    mPoint[1] = rotatedTouchPoint.get1()/objectRatio;
286 282
    mPoint[2] = rotatedTouchPoint.get2()/objectRatio;

Also available in: Unified diff