Revision b972c160
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/objects/RubikObjectMovement.java | ||
---|---|---|
109 | 109 |
float m0 = move2D[0]; |
110 | 110 |
float m1 = move2D[1]; |
111 | 111 |
float len = (float)Math.sqrt(m0*m0 + m1*m1); |
112 |
m0 /= len; |
|
113 |
m1 /= len; |
|
112 |
|
|
113 |
if( len!=0.0f ) |
|
114 |
{ |
|
115 |
m0 /= len; |
|
116 |
m1 /= len; |
|
117 |
} |
|
118 |
else |
|
119 |
{ |
|
120 |
m0 = 1.0f; // arbitrarily |
|
121 |
m1 = 0.0f; // |
|
122 |
} |
|
114 | 123 |
|
115 | 124 |
for(int i=0; i<mNumAxis; i++) |
116 | 125 |
{ |
Also available in: Unified diff
Fix for the next crasher from the field.