Hi everybody,
could you please have a look to my #~@@@ problem ?
i’m new with Xith3d and i try to run xith’s Ase source exemple from Eclipse.
http://www.xith.org/tutes/GettingStarted/html/the_ase_geometry_loader.html
This is the piece of code wich throws me an exception error:
private void loadGeom() {
try {
/*
* Loads the ASE file
*/
AseFile af = new AseFile();
BufferedReader br = null;
try {
// Attempts to read the file normally
br = new BufferedReader(new FileReader("crudetank_mod.ASE"));
} catch (IOException e) {
// Attemts to read file from JAR
URL url = this.getClass().getClassLoader().getResource("crudetank_mod.ASE");
br = new BufferedReader(new InputStreamReader(url.openStream()));
}
AseReader r = new AseReader(br, af);
af.parse(r);
torso = new BranchGroup ();
tankbody = new BranchGroup ();
turret = new BranchGroup ();
// Extracts list of named nodes
java.util.Hashtable views = af.getNamedNodes();
// Iterates though nodes, adding them to relevent base branch groups
for (Enumeration e = views.keys() ; e.hasMoreElements() ;) {
String current = (String) e.nextElement();
if (current.equals("Torso")) {
torso.addChild((BranchGroup) views.get((Object)current));
} else if (current.equals("Body") ) {
tankbody.addChild((BranchGroup) views.get((Object)current));
} else if (current.equals("Turret")) {
//HERE IS THE PROBLEM WICH THROWS THE EXCEPTION
turret.addChild(((BranchGroup) views.get((Object)current));
}
blablabla
The excpetion is :
java.lang.ClassCastException
at Ase.CrudeTank.loadGeom(CrudeTank.java:107)
at Ase.CrudeTank.(CrudeTank.java:63)
at Ase.AseTest.(AseTest.java:94)
at Ase.AseTest.main(AseTest.java:78)
I would like to debugs it.
But before getting started i was wondering; why is there screenshots of this exmple, if it has never worked before.
i know that the .ase file has been read, and that te enumerator is full of stuff, it seems to be a casting problem between BranchGroup and the Node object.
So why does this probem occurs on my pc if this piece of code is supposed to be working ?
Thanks for your help
Psyko The Newbie


