Skip to content

Commit

Permalink
Truncate the rotation vector if it's too big. (sky-map-team#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeetay authored Sep 19, 2016
1 parent c1248ce commit 26b116f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.android.stardroid.util.Geometry;
import com.google.android.stardroid.util.MiscUtil;

import java.util.Arrays;
import java.util.Date;

import static com.google.android.stardroid.util.Geometry.addVectors;
Expand Down Expand Up @@ -187,7 +186,9 @@ public void setPhoneSensorValues(Vector3 acceleration, Vector3 magneticField) {
@Override
public void setPhoneSensorValues(float[] rotationVector) {
// TODO(jontayler): What checks do we need for this to be valid?
this.rotationVector = Arrays.copyOf(rotationVector, rotationVector.length);
// Note on some phones such as the Galaxy S4 this vector is the wrong size and needs to be
// truncated to 4.
System.arraycopy(rotationVector, 0, this.rotationVector, 0, Math.max(rotationVector.length, 4));
useRotationVector = true;
}

Expand Down

0 comments on commit 26b116f

Please sign in to comment.