Мой код
public BranchGroup create3dRoatating () {
objRoot_child = new BranchGroup();
objRoot_child.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND) ;
objRoot_child.setCapability(BranchGroup.ALLOW_DETACH );
objRoot_child.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE) ;
objRoot_child.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
tg_child = new TransformGroup();
tg_child .setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg_child.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
tg_child .setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
t3d_child = new Transform3D();
t3d_child.setTranslation(new Vector3d(-0.62, 1.2, 0.0));
t3d_child.setRotation(new AxisAngle4f(0.0f, 0.0f, 0.0f, 0.0f));
tg_child.setTransform(t3d_child);
tg_ship = new TransformGroup();
tg_ship.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg_ship.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
tg_ship.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
tg_ship.addChild(createObjLoad("model/Cargo Ship.obj"));
alpha = new Alpha(-1,15000);
axis = new Transform3D();
// axis.setRotation(new AxisAngle4f(0.0f, 0.0f, 1.0f, 0.0f));
rotator = new RotationInterpolator(alpha, tg_ship, axis, 0.0f, (float) Math.PI * (2.0f));
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 10000.0);
rotator.setSchedulingBounds(bounds);
tg_ship.addChild(rotator);
tg_child.addChild(tg_ship);
objRoot_child.addChild(tg_child);
objRoot_child.addChild(createLight());
objRoot_child.compile();
return objRoot_child;
}
public void load_sphere () {
group = new BranchGroup();
group.setCapability(BranchGroup.ALLOW_DETACH );
group.setCapability( BranchGroup.ALLOW_CHILDREN_WRITE);
group.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
Sphere sphere = new Sphere(0.2f);
// Cude3d cube = new Cude3d (0.2);
//cube.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
// cube.setCapability(Geometry.ALLOW_INTERSECT);
// group.addChild(cube);
group.addChild(sphere);
Color3f light1Color = new Color3f(1f, 1f, 1f);
Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
BoundingSphere bounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
DirectionalLight light1
= new DirectionalLight(light1Color, light1Direction);
light1.setInfluencingBounds (оценки); * +1007 *
TransformGroup td_sphere=new TransformGroup();
Transform3D tg_sphere=new Transform3D();
td_sphere.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg_sphere.setTranslation(new Vector3d(-0.62, 1.2, 0.0));
td_sphere.setTransform(tg_sphere);
// group.addChild(td_sphere);
//group.addChild(light1);
tg_child.addChild(group);
// group.detach();
}
public void remove_sphere() {
//tg_child.removeChild(group);
group.detach();
// group.setCollidable(true);
// System.out.println(tg_child.getChild(0));
}
После установки возможностей родительской группы ветвей (objRoot_child) и дочерней группы ветвей (группы) я получаю эту ошибку
нажмите
Любая помощь приветствуется.
Имя этого файла - Ship_3d.java.