createDebugFighter("Foe " + i,foeMat, foeMat2, new Vector3f((float)Math.random()*-10, (float)Math.random()*-10, (float)Math.random() * 10 + 15));
}
protected void createDebugFighter(final String name, final Material main, final Material scnd, final Vector3f pos)
{
final IObjectController objCtrl = GlobalObjectStore.getObject(IObjectController.class);
tcc.AddTimedCallback(new ICallback()
{
@Override
public void execute()
{
SpaceObject so = SpaceobjectFactory.eINSTANCE.createAsteroid();
so.setId(nextID++);
so.setLocation(pos);
so.setName(name);
so.setRotation(new Quaternion());
so.setLinearVelocity(new Vector3f());
so.setAngularVelocity(new Quaternion());
Node fighter = new Node(name);
ControlledSpaceObject cso = new ControlledSpaceObject(so, fighter);
cso.setDebugDisplay(name);
cso.setGameThreadCallback(new SpatialUpdater(cso));
Geometry gSphere = new Geometry("Sphere", new Sphere(10,10,0.25f));
Geometry gDirection = new Geometry("Direction-Line", new Line(new Vector3f(0,0,0), new Vector3f(0,0,2)));
gSphere.setMaterial(main);
gDirection.setMaterial(scnd);
fighter.attachChild(gSphere);
fighter.attachChild(gDirection);
SimpleBoundingVolumeFactory.createBestBoundingVolume(fighter);
fighter.setLocalTranslation(pos);
objCtrl.addSpaceObject(cso, true);
}
}, (float) (Math.random() * 5));
}