Kaynağa Gözat

Fixed legs not rotating while not being displayed

Max Nuding 12 yıl önce
ebeveyn
işleme
83e0493c4c
1 değiştirilmiş dosya ile 7 ekleme ve 2 silme
  1. 7
    2
      CubeControl/Led3D.java

+ 7
- 2
CubeControl/Led3D.java Dosyayı Görüntüle

@@ -65,6 +65,7 @@ public class Led3D extends MouseAdapter {
65 65
 			new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f),
66 66
 			new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f), 64.0f);
67 67
 	private Background background;
68
+	private	Appearance feetApp = new Appearance();
68 69
 
69 70
 	
70 71
 	public void toggleLegs(){
@@ -72,6 +73,10 @@ public class Led3D extends MouseAdapter {
72 73
 			group2.detach();
73 74
 		} else {
74 75
 			universe.addBranchGraph(group2);
76
+			Transform3D t = new Transform3D();
77
+			transGroup.getTransform(t);
78
+			feetGroup.setTransform(t);
79
+
75 80
 		}
76 81
 		showLegs = !showLegs;
77 82
 	}
@@ -265,7 +270,7 @@ public class Led3D extends MouseAdapter {
265 270
 	private void drawLedFeetVertical(double x, double y, double z,
266 271
 			float length, float rad) {
267 272
 		// draw Feet going down
268
-		Appearance feetApp = new Appearance();
273
+		
269 274
 		feetApp.setMaterial(whiteMat);
270 275
 		feetApp.setColoringAttributes(whiteColor);
271 276
 		Cylinder c = new Cylinder(rad, length, feetApp);
@@ -283,7 +288,7 @@ public class Led3D extends MouseAdapter {
283 288
 	private void drawLedFeetHorizontal(double x, double y, double z,
284 289
 			float length, float rad, int deg) {
285 290
 		// draw Feet going down
286
-		Appearance feetApp = new Appearance();
291
+	
287 292
 		feetApp.setMaterial(whiteMat);
288 293
 		feetApp.setColoringAttributes(whiteColor);
289 294
 		Cylinder c = new Cylinder(rad, length, feetApp);

Loading…
İptal
Kaydet