Little Help

Well, First of all

Hi guys, this is my first post here. ;D

Anyway, i have to do a little project to my college using xith, but i´m really noob about this engine.

I have to do a chemistry laboratory and i don´t know what loader i use to make a closet wich the doors open by a click of the mouse.
I tryed with ASE but it didn´t work, cuz i´m having a little problem with how to get the shape of the doors so i can use picking on it.

Is ASE the easiest way for doingt it?

Bye

PS: Sorry for bad english (i´m from Brazil :D)

Welcome ;D

Go through http://www.xith.org/pages/documentation.html for fast start with Xith, and don’t forget to check latest “Xith In Nutshell” (XIN) documentation. It is in “doc” directory in “xith-tk”.

First of all check the Models chapter in XIN for fast references and recommendation of what models is better to use and which of them support animation - this would be recent information.
I’ll reccomend to have fast look through some older post here also, just to pick hints and ideas and get aware of possible problems:
http://www.java-gaming.org/forums/index.php?topic=8353.0
http://www.java-gaming.org/forums/index.php?topic=8766.0
http://www.java-gaming.org/forums/index.php?topic=10539.0
http://www.java-gaming.org/forums/index.php?topic=12914.0
http://www.java-gaming.org/forums/index.php?topic=13005.0
http://www.java-gaming.org/forums/index.php?topic=14263.0
http://www.java-gaming.org/forums/index.php?topic=3824.0
http://www.java-gaming.org/forums/index.php?topic=6316.0
http://www.java-gaming.org/forums/index.php?topic=6487.0
http://www.java-gaming.org/forums/index.php?topic=6976.0

I didn’t clearly get here… you mean that you actually can load ASE model and animate, but you can’t isolate the “doors” only to “be listening” to your events (roughly saying…)? Is it?
Well, I don’t have personaly much experience with animating, and other loaders appart from 3DS (which doesn’t support animation anyhow), but you should be able to get name of the node you pick, and provided you knew the Shape3D name of the doors itself you should be fine. Have you tried Node.getName() method for nodes returned by picking?

I knew it was the problem with the getName method some time ago for the models loaded (not created) retuning an empty String, but I believe it was resolved.

See picking exapmles in Getting Started Guide and also in XIN, aren’t they suitable for you?
And don’t forget also you can selectively specify which nodes you want to be pickable and which not.

Bohdan.

Your question probably would easier to answer further if you could specify on what exactly level you are getting stopped:

1.Did you get you model properly loaded?
2. Did you test that animation works?
3. Is picking returning results if you click (or whatever mouse listener you assigned) on the closet/doors?
4. Can you check the names of nodes you pick?

Bohdan.

Sorry for the bad explanantion,

the problem is that i´m trying to get the shape of the door using the getNodeNamed() of ase loader, and i it doesen´t return the model in the scene.

The code to load the scene is this:

public class Armario_Porta {

private BranchGroup armario; // the closet
private BranchGroup porta_direita; // the right door
private BranchGroup porta_esquerda; // the left door

public Armario_Porta () {
	loadGeom();
}

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("FindTheElements/Models/Armario_Porta.ASE"));
		
		} catch (IOException e) {
			// Attemts to read file from JAR
			URL url = this.getClass().getClassLoader().getResource("FindTheElements/Models/Armario_Porta.ASE");
			br = new BufferedReader(new InputStreamReader(url.openStream()));
		}
		
		AseReader r = new AseReader(br);
		af.parse(r);
		
		armario = new BranchGroup ();
		porta_direita = new BranchGroup ();
		porta_esquerda = new BranchGroup ();

		// Extracts list of named nodes
		Map nodes = af.getNamedNodesMap();
		
		armario.addChild((Node) nodes.get("Armario"));
		porta_direita.addChild((Node) nodes.get("Porta_Dir01"));
		porta_esquerda.addChild((Node) nodes.get("Porta_Esq01"));
		
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}

public BranchGroup getArmario() {
	return armario;
}

public BranchGroup getPortaDireita() {
	return porta_direita;
}

public BranchGroup getPortaEsquerda() {
	return porta_esquerda;	
}

}

and the code to create the transform so i can translate the door when picked is this:

public void loadScene() throws IOException{
AseFile sala = new AseFile();
BufferedReader br_sala = null;

try {
    // Attempts to read the file normally
    br_sala = new BufferedReader(new FileReader("FindTheElements/Models/Sala.ASE"));
} catch (IOException e) {
    // Attemts to read file from JAR
    URL url = this.getClass().getClassLoader().getResource("FindTheElements/Models/Sala.ASE");
    br_sala = new BufferedReader(new InputStreamReader(url.openStream()));
}

AseReader r_sala = new AseReader(br_sala, sala);
sala.parse(r_sala);

java.util.HashMap namedNodes = new java.util.HashMap();
TransformGroup raiz_TG = sala.getTransformGroupTree(namedNodes);

Armario_Porta armario01 = new Armario_Porta();

TransformGroup porta_esq01 = new TransformGroup ();
porta_esq01.addChild(armario01.getPortaEsquerda());

TransformGroup porta_dir01 = new TransformGroup ();
porta_dir01.addChild(armario01.getPortaDireita());

TransformGroup tg_armario_porta01 = new TransformGroup ();
tg_armario_porta01.addChild(armario01.getArmario());
tg_armario_porta01.addChild(porta_esq01);
tg_armario_porta01.addChild(porta_dir01);

sceneGroup.addChild(raiz_TG);
sceneGroup.addChild(tg_armario_porta01);
Vector3f pos = new Vector3f(-34.078f,-15.722f, -91);
Transform3D tr = new Transform3D();
        tg_armario_porta01.getTransform(tr);
        tr.rotY(-3.0f);
        tr.setTranslation(pos);
        tg_armario_porta01.setTransform(tr);

}

but in the scene it shows the shape of the closet but none of doors

First of all, welcome to Xith3D ! And good luck…

For your problem : double-check your node names are correct.

You could easily use three different models : closet, left door, right door

[quote="<MagicSpark.org [ BlueSky ]>,post:5,topic:28378"]
First of all, welcome to Xith3D ! And good luck…
[/quote]
Thanks

[quote="<MagicSpark.org [ BlueSky ]>,post:5,topic:28378"]
For your problem : double-check your node names are correct.

You could easily use three different models : closet, left door, right door
[/quote]
I´ll try that, thanks a lot