Revision 77899b4c
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/objects/RubikHelicopter.java | ||
---|---|---|
365 | 365 |
float[] vertices1 = { -F,-G, +F,-G, 0,2*G}; |
366 | 366 |
|
367 | 367 |
float[] bands1 = { 1.0f , 0.0f, |
368 |
0.5f , 0.02f,
|
|
369 |
0.0f , 0.03f };
|
|
368 |
0.5f , 0.01f,
|
|
369 |
0.0f , 0.01f };
|
|
370 | 370 |
|
371 | 371 |
meshes[1] = new MeshPolygon(vertices1, bands1, 1, 3); |
372 | 372 |
meshes[1].setEffectAssociation(0,2,0); |
... | ... | |
404 | 404 |
Static3D center = new Static3D(0,0,0); |
405 | 405 |
Static3D center1= new Static3D(-0.25f,-0.25f,0); |
406 | 406 |
|
407 |
float d0 =-0.04f;
|
|
407 |
float d0 =-0.03f;
|
|
408 | 408 |
float d1 =-0.04f; |
409 | 409 |
float r0 = 0.15f; |
410 | 410 |
float r1 = 0.10f; |
... | ... | |
620 | 620 |
|
621 | 621 |
public int computeRowFromOffset(float offset) |
622 | 622 |
{ |
623 |
return offset<0.125f ? 0:1;
|
|
623 |
return offset<0.125f ? 0:3;
|
|
624 | 624 |
} |
625 | 625 |
|
626 | 626 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/RubikMovementHelicopter.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 32 |
// _____________ |
33 |
// | \ 0 / |
|
|
34 |
// | \ / |
|
|
35 |
// | 3 | | 1 |
|
|
36 |
// | / \ |
|
|
37 |
// | / 2 \ |
|
|
33 |
// | | |
|
|
34 |
// | 3 | 0 |
|
|
35 |
// |-----------|
|
|
36 |
// | | |
|
|
37 |
// | 2 | 1 |
|
|
38 | 38 |
// ------------- |
39 | 39 |
|
40 | 40 |
private int getQuarter(float[] touchPoint) |
41 | 41 |
{ |
42 |
boolean p0 = touchPoint[1] >= touchPoint[0];
|
|
43 |
boolean p1 = touchPoint[1] >=-touchPoint[0];
|
|
42 |
boolean p0 = touchPoint[0] > 0;
|
|
43 |
boolean p1 = touchPoint[1] > 0;
|
|
44 | 44 |
|
45 |
if( p0 ) return p1 ? 0:3;
|
|
46 |
else return p1 ? 1:2;
|
|
45 |
if( p0 ) return p1 ? 0:1;
|
|
46 |
else return p1 ? 3:2;
|
|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
61 | 61 |
|
62 | 62 |
int quarter = getQuarter(touchPoint); |
63 | 63 |
|
64 |
|
|
65 |
android.util.Log.e("heli", "point= "+touchPoint[0]+" "+touchPoint[1]+" face="+face+" q:"+quarter); |
|
66 |
|
|
64 | 67 |
switch(face) |
65 | 68 |
{ |
66 | 69 |
case 0: switch(quarter) |
67 | 70 |
{ |
68 |
case 0: enabled[1]=0; enabled[2]=1; break;
|
|
69 |
case 1: enabled[1]=3; enabled[2]=1; break;
|
|
70 |
case 2: enabled[1]=2; enabled[2]=3; break;
|
|
71 |
case 3: enabled[1]=0; enabled[2]=2; break;
|
|
71 |
case 0: enabled[1]=1; enabled[2]=3; break;
|
|
72 |
case 1: enabled[1]=0; enabled[2]=3; break;
|
|
73 |
case 2: enabled[1]=0; enabled[2]=2; break;
|
|
74 |
case 3: enabled[1]=1; enabled[2]=2; break;
|
|
72 | 75 |
} |
73 | 76 |
break; |
74 | 77 |
case 1: switch(quarter) |
Also available in: Unified diff
More support for the Helicopter.