public class start3 extends JFrame
{
private JPanel m_content_panel;
public static Canvas3D m_canvas3d;
private SimpleUniverse m_simpleu = null;
private BranchGroup m_scene;
private final double SIZE=2.0*Math.PI, STEP=30;
public SymMouse aSymMouse=new SymMouse();
static TransformGroup TG_Auswahl;
public static BranchGroup obj_root = new BranchGroup();
Appearance BLAU1Appearance=new Appearance();
Shape3D shape1;
TransformGroup auswahlTG;
TransformGroup control;
public BoundingSphere bounds=new BoundingSphere(new Point3d(0.0,0.0,0.0),100.0);
TransformGroup content;
BoundingSphere boundssound=new BoundingSphere(new Point3d(0.0,0.0,0.0),100.0);
public static Point3f test;
public static PointLight lightB1;
Transform3D Trans_TG1;
Bounds boundsTeil1;
Bounds boundsTeil2;
Bounds boundsTeil3;
Bounds boundsTeil4;
Bounds boundsTeil5;
static boolean teil1 = false;
static boolean teil2 = false;
static boolean teil3 = false;
static boolean teil4 = false;
static boolean teil5 = false;
//**********************************************************
public static int cp = 1; //aktuelle position verbinden mit aktivem element
public static int ccp;
// X Z
public static float[][] pos1 = {{-1.5708f,0.0f},
{3.1416f, 0.0f},
{1.5708f, 0.0f},
{0.0f, 1.5708f},
{0.0f, -1.5708f},};
public static boolean cube_e_0 = false;
public static boolean cube_e_1 = false;
public static boolean cube_e_2 = false;
public static boolean cube_e_3 = true;
public static boolean cube_e_4 = false;
public static float[] pos2 = {0.0f,1.5708f,3.1416f,-1.5708f};
public static int cr = 1;// pos3[1][aktives elemrnt]
public static float ccr;
// t0 t1 t2 t3
//**********************************************************
public static int move_test[][]= {{3,2 ,4,3 ,1,0 ,5,1},
{0,2 ,4,2 ,2,0 ,5,2},
{1,2 ,4,1 ,3,0 ,5,3},
{2,2 ,4,0 ,0,0 ,5,0},
{3,1 ,2,1 ,1,1 ,0,1},
{3,3 ,0,3 ,1,3 ,2,3},};
public static int pos3[][]= {{0,3,0,2, 0 ,0},//element
{0,3,0,2, 0 ,0},//rotation
{0,4,8,12,16,20},};
//**********************************************************
public start3(int width, int height)
{
super("Happy Cube");
BranchGroup obj_root = new BranchGroup();
obj_root.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
obj_root.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
m_content_panel = new JPanel();
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
m_canvas3d = new Canvas3D(config);
m_canvas3d.addMouseListener(aSymMouse);
this.setContentPane(m_content_panel);
m_content_panel.setLayout(new BorderLayout());
this.m_content_panel.add("Center",m_canvas3d);
m_simpleu = new SimpleUniverse(m_canvas3d);
AudioDevice audioDev = m_simpleu.getViewer().createAudioDevice();
audioDev.setAudioPlaybackType(AudioDevice.STEREO_SPEAKERS);
m_simpleu.getViewingPlatform().setNominalViewingTransform();
m_scene = createSceneGraph();
m_simpleu.addBranchGraph(m_scene);
/*************************************************************************
//Hier versuchen wir die derzeitige Position der Trans_TG1 auszulesen
TransformGroup test = new TransformGroup();
test.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
test.setCapability(TransformGroup.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
test.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
test.getLocalToVworld(Trans_TG1);
/***********************************************************************
System.out.println("Versuch: "+ Trans_TG1);
this.addWindowListener(new WindowClosingAdapter());
this.setBackground(new Color(0,0,0));
this.setSize(width, height);
this.setVisible(true);
m_scene.compile();
}
private TransformGroup createLights() //fertig
{
// 1.3.1
Vector3f direction1 = new Vector3f(0.0f, -1.0f, 0.0f);
direction1.normalize();
// 1.3
DirectionalLight lightD1 = new DirectionalLight();
lightD1.setInfluencingBounds(new BoundingSphere());
lightD1.setDirection(direction1);
// 1.2
PointLight lightB = new PointLight();
lightB.setInfluencingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),600.0));
lightB.setPosition(0f,2f,2f);
// 1.1
AmbientLight lightA = new AmbientLight();
lightA.setInfluencingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),600.0));
// 1
TransformGroup lightTG = new TransformGroup();
lightTG.addChild(lightA);
lightTG.addChild(lightB);
lightTG.addChild(lightD1);
return lightTG;
}
public BranchGroup createSceneGraph() // fertig
{
TransformGroup sceneBG = new createBG();
// 1.1.3
TransformGroup sceneLight = createLights();
BLAU1Appearance.setMaterial(new Material(new Color3f(0f,0f,1f),new Color3f(0f,0f,0f),new Color3f(0f,0f,0f),new Color3f(1f,1f,1f),100f));
//Behavior blau 1
bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),10.0);
KeyBehavior KeyCtrl=new KeyBehavior();
KeyCtrl.setSchedulingBounds(bounds);
obj_root.addChild(KeyCtrl);
//Positionierung des gesamten Cubes
Vector3f v3 = new Vector3f(-0.3f,0.0f,0.0f);
Transform3D ST = new Transform3D();
ST.setTranslation(v3);
content = new createMouseBehavior();
content.setTransform(ST);
content.addChild(new control());
float xTG = 0.8f;///POS Rechts
float transparenz = 1.0f;
///AUSWAHL1!///1
Transform3D drehT3D1 = new Transform3D();
drehT3D1.rotX(Math.PI/2);
TransformGroup drehTG1 = new TransformGroup(drehT3D1);
Transform3D scalTG1 = new Transform3D();
scalTG1.set(0.025f);
TransformGroup TG1Scal = new TransformGroup(scalTG1);
TG1Scal.addChild(drehTG1);
Trans_TG1 = new Transform3D();
Trans_TG1.setTranslation(new Vector3f(xTG,0.5f,0.0f));
TransformGroup TG1 = new TransformGroup(Trans_TG1);
TG1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG1.setCapability(TransformGroup.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
TG1.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
TG1.addChild(TG1Scal);
element_rot_1 geom1 = new element_rot_1();
for (int n=0; n<geom1.getShapeCount(); n++)
drehTG1.addChild(geom1.getShape(n));
//Breite //Höhe //Dicke
//0.125, 0.125, 0.033 ,1
Shape3D box1 = new Box(0.13, 0.13, 0.036 ,1);
box1.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
// box1.setBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),1.0));
TG1.addChild(box1);
/// Farbe Würfel
Appearance app1 = new Appearance();
app1.setMaterial(new Material(new Color3f(0.5f,0f,0.5f),new Color3f(0f,0f,0f),new Color3f(1f,0f,0f),new Color3f(1f,1f,1f),100f));
box1.setAppearance(app1);
ColoringAttributes ca1 = new ColoringAttributes();
ca1.setColor(0.6f, 0.3f, 0.0f);
app1.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
app1.setColoringAttributes(ca1);
app1.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,transparenz));
// Bewegung Teil1
Transform3D yAxis1 = new Transform3D();
yAxis1.rotX(1.54f);
//duration
Alpha animAlpha1 = new Alpha (-1,Alpha.INCREASING_ENABLE,0,0,9000,0,0,0,0,0);
KBKeyFrame[] splineKeyFrames1 = new KBKeyFrame[2];
Vector3f pos_10 = new Vector3f( xTG,0.0f,-0.5f);// Zahlenwerte sind verschoben! YWert ist vertauscht!
Vector3f pos_11 = new Vector3f( 0.0f, 0.0f, 0.0f);
Point3f p1 = new Point3f (pos_10);
float head1 = 0.0f; // y-achse
float pitch1 = 0.0f; // z-achse FALSCH
float bank1 = 0.0f; // x-achse
Point3f s1 = new Point3f(1.0f, 1.0f, 1.0f);
splineKeyFrames1[0] = new KBKeyFrame(0.0f, 0, p1, head1, pitch1, bank1, s1, 0.0f, 0.0f, 0.0f);
p1 = new Point3f (pos_11);
head1 = 0.0f;
pitch1 = 0f;
bank1 = 0f;
splineKeyFrames1[1] = new KBKeyFrame(1.0f, 0, p1, head1, pitch1, bank1, s1, 0.0f, 0.0f, 0.0f);
KBRotPosScaleSplinePathInterpolator splineInterpolator1 = new KBRotPosScaleSplinePathInterpolator(animAlpha1, TG1,yAxis1, splineKeyFrames1);
splineInterpolator1.setSchedulingBounds(bounds);
TransformGroup TG1Move = new TransformGroup();
TG1Move.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG1Move.addChild(splineInterpolator1);
TG1Move.addChild(TG1);
//////AUSWAHL2!///////////////////////////////////
Transform3D drehT3D2 = new Transform3D();
drehT3D2.rotX(Math.PI/2);
TransformGroup drehTG2 = new TransformGroup(drehT3D2);
Transform3D scalTG2 = new Transform3D();
scalTG2.set(0.025f);
TransformGroup TG2Scal = new TransformGroup(scalTG2);
TG2Scal.addChild(drehTG2);
Transform3D Trans_TG2 = new Transform3D();
Trans_TG2.setTranslation(new Vector3f(xTG,0.3f,0.0f));
TransformGroup TG2 = new TransformGroup(Trans_TG2);
TG2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG2.addChild(TG2Scal);
element_rot_2 geom2 = new element_rot_2();
for (int n=0; n<geom2.getShapeCount(); n++)
drehTG2.addChild(geom2.getShape(n));
Shape3D box2 = new Box(0.13, 0.13, 0.036 ,2);
box2.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
// box2.setBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),1.0));
TG2.addChild(box2);
/// Farbe Würfel
Appearance app2 = new Appearance();
app2.setMaterial(new Material(new Color3f(0.5f,0f,0.5f),new Color3f(0f,0f,0f),new Color3f(1f,0f,0f),new Color3f(1f,1f,1f),100f));
box2.setAppearance(app2);
ColoringAttributes ca2 = new ColoringAttributes();
ca2.setColor(0.6f, 0.3f, 0.0f);
app2.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
app2.setColoringAttributes(ca2);
app2.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,transparenz));
// Bewegung Teil2
Transform3D yAxis2 = new Transform3D();
yAxis2.rotX(1.54f);
//duration
Alpha animAlpha2 = new Alpha (-1,Alpha.INCREASING_ENABLE,0,0,9000,0,0,0,0,0);
KBKeyFrame[] splineKeyFrames2 = new KBKeyFrame[2];
Vector3f pos_20 = new Vector3f( xTG,0.0f,-0.3f);// Zahlenwerte sind verschoben! YWert ist vertauscht!
Vector3f pos_21 = new Vector3f( 0.0f, 0.0f, 0.0f);
Point3f p2 = new Point3f (pos_20);
float head2 = 0.0f; // y-achse
float pitch2 = 0.0f; // z-achse FALSCH
float bank2 = 0.0f; // x-achse
Point3f s2 = new Point3f(1.0f, 1.0f, 1.0f);
splineKeyFrames2[0] = new KBKeyFrame(0.0f, 0, p2, head2, pitch2, bank2, s2, 0.0f, 0.0f, 0.0f);
p2 = new Point3f (pos_21);
head2 = 0.0f;
pitch2 = 0f;
bank2 = 0f;
splineKeyFrames2[1] = new KBKeyFrame(1.0f, 0, p2, head2, pitch2, bank2, s2, 0.0f, 0.0f, 0.0f);
KBRotPosScaleSplinePathInterpolator splineInterpolator2 = new KBRotPosScaleSplinePathInterpolator(animAlpha2, TG2,yAxis2, splineKeyFrames2);
splineInterpolator2.setSchedulingBounds(bounds);
TransformGroup TG2Move = new TransformGroup();
TG2Move.addChild(splineInterpolator2);
TG2Move.addChild(TG2);
////Auswahl3 //////////////////////////////
Transform3D drehT3D3 = new Transform3D();
drehT3D3.rotX(Math.PI/2);
TransformGroup drehTG3 = new TransformGroup(drehT3D3);
Transform3D scalTG3 = new Transform3D();
scalTG3.set(0.025f);
TransformGroup TG3Scal = new TransformGroup(scalTG3);
TG3Scal.addChild(drehTG3);
Transform3D Trans_TG3 = new Transform3D();
Trans_TG3.setTranslation(new Vector3f(xTG,0.1f,0.0f));
TransformGroup TG3 = new TransformGroup(Trans_TG3);
TG3.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG3.addChild(TG3Scal);
element_rot_3 geom3 = new element_rot_3();
for (int n=0; n<geom3.getShapeCount(); n++)
drehTG3.addChild(geom3.getShape(n));
Shape3D box3 = new Box(0.13, 0.13, 0.036 ,3);
box3.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
TG3.addChild(box3);
/// Farbe Würfel
Appearance app3 = new Appearance();
app3.setMaterial(new Material(new Color3f(0.5f,0f,0.5f),new Color3f(0f,0f,0f),new Color3f(1f,0f,0f),new Color3f(1f,1f,1f),100f));
box3.setAppearance(app3);
ColoringAttributes ca3 = new ColoringAttributes();
ca3.setColor(0.6f, 0.3f, 0.0f);
app3.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
app3.setColoringAttributes(ca3);
app3.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,transparenz));
// Bewegung Teil3
Transform3D yAxis3 = new Transform3D();
yAxis3.rotX(1.54f);
//duration
Alpha animAlpha3 = new Alpha (-1,Alpha.INCREASING_ENABLE,0,0,9000,0,0,0,0,0);
KBKeyFrame[] splineKeyFrames3 = new KBKeyFrame[2];
Vector3f pos_30 = new Vector3f( xTG,0.0f,-0.1f);// Zahlenwerte sind verschoben! YWert ist vertauscht!
Vector3f pos_31 = new Vector3f( 0.0f, 0.0f, 0.0f);
Point3f p3 = new Point3f (pos_30);
float head3 = 0.0f; // y-achse
float pitch3 = 0.0f; // z-achse FALSCH
float bank3 = 0.0f; // x-achse
Point3f s3 = new Point3f(1.0f, 1.0f, 1.0f);
splineKeyFrames3[0] = new KBKeyFrame(0.0f, 0, p3, head3, pitch3, bank3, s3, 0.0f, 0.0f, 0.0f);
p3 = new Point3f (pos_31);
head3 = 0.0f;
pitch3 = 0f;
bank3 = 0f;
splineKeyFrames3[1] = new KBKeyFrame(1.0f, 0, p3, head3, pitch3, bank3, s3, 0.0f, 0.0f, 0.0f);
KBRotPosScaleSplinePathInterpolator splineInterpolator3 = new KBRotPosScaleSplinePathInterpolator(animAlpha3, TG3,yAxis3, splineKeyFrames3);
splineInterpolator3.setSchedulingBounds(bounds);
TransformGroup TG3Move = new TransformGroup();
TG3Move.addChild(splineInterpolator3);
TG3Move.addChild(TG3);
////Auswahl4/////////////////////////////////
Transform3D drehT3D4 = new Transform3D();
drehT3D4.rotX(Math.PI/2);
TransformGroup drehTG4 = new TransformGroup(drehT3D4);
Transform3D scalTG4 = new Transform3D();
scalTG4.set(0.025f);
TransformGroup TG4Scal = new TransformGroup(scalTG4);
TG4Scal.addChild(drehTG4);
Transform3D Trans_TG4 = new Transform3D();
Trans_TG4.setTranslation(new Vector3f(xTG,-0.1f,0.0f));
TransformGroup TG4 = new TransformGroup(Trans_TG4);
TG4.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG4.addChild(TG4Scal);
element_rot_4 geom4 = new element_rot_4();
for (int n=0; n<geom4.getShapeCount(); n++)
drehTG4.addChild(geom4.getShape(n));
//Breite //Höhe //Dicke
Shape3D box4 = new Box(0.13, 0.13, 0.036 ,4);
box4.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
TG4.addChild(box4);
/// Farbe Würfel
Appearance app4 = new Appearance();
app4.setMaterial(new Material(new Color3f(0.5f,0f,0.5f),new Color3f(0f,0f,0f),new Color3f(1f,0f,0f),new Color3f(1f,1f,1f),100f));
box4.setAppearance(app4);
ColoringAttributes ca4 = new ColoringAttributes();
ca4.setColor(0.6f, 0.3f, 0.0f);
app4.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
app4.setColoringAttributes(ca4);
app4.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,transparenz));
// Bewegung Teil4
Transform3D yAxis4 = new Transform3D();
yAxis4.rotX(1.54f);
//duration
Alpha animAlpha4 = new Alpha (-1,Alpha.INCREASING_ENABLE,0,0,9000,0,0,0,0,0);
KBKeyFrame[] splineKeyFrames4 = new KBKeyFrame[2];
Vector3f pos_40 = new Vector3f( xTG,0.0f,0.1f);// Zahlenwerte sind verschoben! YWert ist vertauscht!
Vector3f pos_41 = new Vector3f( 0.0f, 0.0f, 0.0f);
Point3f p4 = new Point3f (pos_40);
float head4 = 0.0f; // y-achse
float pitch4 = 0.0f; // z-achse FALSCH
float bank4 = 0.0f; // x-achse
Point3f s4 = new Point3f(1.0f, 1.0f, 1.0f);
splineKeyFrames4[0] = new KBKeyFrame(0.0f, 0, p4, head4, pitch4, bank4, s4, 0.0f, 0.0f, 0.0f);
p4 = new Point3f (pos_41);
head4 = 0.0f;
pitch4 = 0f;
bank4 = 0f;
splineKeyFrames4[1] = new KBKeyFrame(1.0f, 0, p4, head4, pitch4, bank4, s4, 0.0f, 0.0f, 0.0f);
KBRotPosScaleSplinePathInterpolator splineInterpolator4 = new KBRotPosScaleSplinePathInterpolator(animAlpha4, TG4,yAxis4, splineKeyFrames4);
splineInterpolator4.setSchedulingBounds(bounds);
TransformGroup TG4Move = new TransformGroup();
TG4Move.addChild(splineInterpolator4);
TG4Move.addChild(TG4);
///Auswahl5///////////////////////////////////
Transform3D drehT3D5 = new Transform3D();
drehT3D5.rotX(Math.PI/2);
TransformGroup drehTG5 = new TransformGroup(drehT3D5);
Transform3D scalTG5 = new Transform3D();
scalTG5.set(0.025f);
TransformGroup TG5Scal = new TransformGroup(scalTG5);
TG5Scal.addChild(drehTG5);
Transform3D Trans_TG5 = new Transform3D();
Trans_TG5.setTranslation(new Vector3f(xTG,-0.3f,0.0f));
TransformGroup TG5 = new TransformGroup(Trans_TG5);
TG5.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG5.addChild(TG5Scal);
element_rot_5 geom5 = new element_rot_5();
for (int n=0; n<geom5.getShapeCount(); n++)
drehTG5.addChild(geom5.getShape(n));
Shape3D box5 = new Box(0.13, 0.13, 0.036 ,5);
box5.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
TG5.addChild(box5);
/// Farbe Würfel
Appearance app5 = new Appearance();
app5.setMaterial(new Material(new Color3f(0.5f,0f,0.5f),new Color3f(0f,0f,0f),new Color3f(1f,0f,0f),new Color3f(1f,1f,1f),100f));
box5.setAppearance(app5);
ColoringAttributes ca5 = new ColoringAttributes();
ca5.setColor(0.6f, 0.3f, 0.0f);
app5.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
app5.setColoringAttributes(ca5);
app5.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,transparenz));
// Bewegung Teil5
Transform3D yAxis5 = new Transform3D();
yAxis5.rotX(1.54f);
//duration
Alpha animAlpha5 = new Alpha (-1,Alpha.INCREASING_ENABLE,0,0,9000,0,0,0,0,0);
KBKeyFrame[] splineKeyFrames5 = new KBKeyFrame[2];
Vector3f pos_50 = new Vector3f( xTG,0.4f,0.5f);// Zahlenwerte sind verschoben! YWert ist vertauscht!
Vector3f pos_51 = new Vector3f( 0.0f, 0.0f, 0.0f);
Point3f p5 = new Point3f (pos_50);
float head5 = 0.0f; // y-achse
float pitch5 = 0.0f; // z-achse FALSCH
float bank5 = 0.0f; // x-achse
Point3f s5 = new Point3f(1.0f, 1.0f, 1.0f);
splineKeyFrames5[0] = new KBKeyFrame(0.0f, 0, p5, head5, pitch5, bank5, s5, 0.0f, 0.0f, 0.0f);
p5 = new Point3f (pos_51);
head5 = 0.0f;
pitch5 = 0f;
bank5 = 0f;
splineKeyFrames5[1] = new KBKeyFrame(1.0f, 0, p5, head5, pitch5, bank5, s5, 0.0f, 0.0f, 0.0f);
KBRotPosScaleSplinePathInterpolator splineInterpolator5 = new KBRotPosScaleSplinePathInterpolator(animAlpha5, TG5,yAxis5, splineKeyFrames5);
splineInterpolator5.setSchedulingBounds(bounds);
TransformGroup TG5Move = new TransformGroup();
TG5Move.addChild(splineInterpolator5);
TG5Move.addChild(TG5);
///Wände///////////////////////////////////////////////////
Shape3D wand1 = new Box(0.001, 1.4, 1.0 ,6);
wand1.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
Shape3D wand2 = new Box(0.001, 1.4, 1.0 ,7);
wand2.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
Transform3D drehWand1 = new Transform3D();
drehWand1.rotY(-0.12f);
TransformGroup TGdrehWand1 = new TransformGroup(drehWand1);
TGdrehWand1.addChild(wand1);
Transform3D Transwand1 = new Transform3D();
Transwand1.setTranslation(new Vector3f(0.3f,0.0f,0.0f));
TransformGroup TGTranswand1 = new TransformGroup(Transwand1);
TGTranswand1.addChild(TGdrehWand1);
Transform3D drehWand2 = new Transform3D();
drehWand2.rotY(-0.333f);
TransformGroup TGdrehWand2 = new TransformGroup(drehWand2);
TGdrehWand2.addChild(wand2);
Transform3D Transwand2 = new Transform3D();
Transwand2.setTranslation(new Vector3f(0.98f,0.0f,0.0f));
TransformGroup TGTranswand2 = new TransformGroup(Transwand2);
TGTranswand2.addChild(TGdrehWand2);
TransformGroup waende = new TransformGroup();
waende.addChild(TGTranswand1);
waende.addChild(TGTranswand2);
///Sound Backround
TransformGroup Sound = new TransformGroup();
Sound.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Sound.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
myBackgroundSound bsound = new myBackgroundSound("file:./bgsound.wav",5.0f,true);
// Sound.addChild(bsound);
///
///Kollisions Aufruf///
CollisionDetector cd = new CollisionDetector(box1);
BoundingSphere boundsCD = new BoundingSphere(new Point3d(0.0,0.0,0.0),1.0);
cd.setSchedulingBounds(boundsCD);
TG1.addChild(cd);
CollisionDetector2 cd2 = new CollisionDetector2(box2);
cd2.setSchedulingBounds(boundsCD);
TG2.addChild(cd2);
CollisionDetector3 cd3 = new CollisionDetector3(box3);
cd3.setSchedulingBounds(boundsCD);
TG3.addChild(cd3);
CollisionDetector4 cd4 = new CollisionDetector4(box4);
cd4.setSchedulingBounds(boundsCD);
TG4.addChild(cd4);
CollisionDetector5 cd5 = new CollisionDetector5(box5);
cd5.setSchedulingBounds(boundsCD);
TG5.addChild(cd5);
CollisionDetector6 cd6 = new CollisionDetector6(wand1);
cd6.setSchedulingBounds(boundsCD);
waende.addChild(cd6);
CollisionDetector7 cd7 = new CollisionDetector7(wand2);
cd7.setSchedulingBounds(boundsCD);
waende.addChild(cd7);
///////////////////////////////////
TG_Auswahl = new TransformGroup();
TG_Auswahl.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG_Auswahl.addChild(TG1Move);
TG_Auswahl.addChild(TG2Move);
TG_Auswahl.addChild(TG3Move);
TG_Auswahl.addChild(TG4Move);
TG_Auswahl.addChild(TG5Move);
TG_Auswahl.addChild(waende);
obj_root.addChild(TG_Auswahl);
obj_root.addChild(content);
obj_root.addChild(sceneBG);
obj_root.addChild(Sound);
obj_root.setCapability(BranchGroup.ALLOW_DETACH);
obj_root.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
obj_root.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
obj_root.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
return obj_root;
}
}