private Node createObjects() {
final Node objects = new Node("objects");
final Torus torus = new Torus("Torus", 30, 20, 8, 17);
torus.setTranslation(new Vector3(50, -5, 20));
TextureState ts = new TextureState();
torus.addController(new SpatialController<Torus>() {
private double timer = 0;
private final Matrix3 rotation = new Matrix3();
public void update(final double time, final Torus caller) {
timer += time * 0.5;
caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
caller.setRotation(rotation);
}
});
Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
Texture.MinificationFilter.BilinearNearestMipMap, true);
ts.setTexture(t0, 0);
ts.setEnabled(true);
torus.setRenderState(ts);
objects.attachChild(torus);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
box.setTranslation(new Vector3(0, -7, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(15, 10, 0));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(0, -10, 15));
box.setRenderState(ts);
objects.attachChild(box);
box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
box.setTranslation(new Vector3(20, 0, 0));
box.setRenderState(ts);
objects.attachChild(box);
ts = new TextureState();
t0 = TextureManager
.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
t0.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(t0);
box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
box.setTranslation(new Vector3(0, -15, 0));
box.setRenderState(ts);
box.setModelBound(new BoundingBox());