Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Little Help  (Read 1264 times)
0 Members and 1 Guest are viewing this topic.
Offline rafa_es

Junior Member





« Posted 2006-09-20 21:55:19 »

Well, First of all

Hi guys, this is my first post here.  Grin

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  Cheesy)
Offline bohdan

Junior Member




Java-positive...


« Reply #1 - Posted 2006-09-21 11:30:33 »

Hi guys, this is my first post here.  Grin
Welcome  Grin

Anyway, i have to do a little project to my college using xith, but i´m really noob about this engine.
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".

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.
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 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?
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.
Offline bohdan

Junior Member




Java-positive...


« Reply #2 - Posted 2006-09-21 11:59:39 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline rafa_es

Junior Member





« Reply #3 - Posted 2006-09-21 14:15:35 »

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
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #4 - Posted 2006-09-21 18:13:11 »

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

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline rafa_es

Junior Member





« Reply #5 - Posted 2006-09-21 18:18:38 »

First of all, welcome to Xith3D ! And good luck..
Thanks

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

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

I´ll try that, thanks a lot
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (1 views)
2014-07-23 21:16:32

Riven (3 views)
2014-07-23 21:07:15

Riven (5 views)
2014-07-23 20:56:16

ctomni231 (39 views)
2014-07-18 06:55:21

Zero Volt (36 views)
2014-07-17 23:47:54

danieldean (29 views)
2014-07-17 23:41:23

MustardPeter (32 views)
2014-07-16 23:30:00

Cero (47 views)
2014-07-16 00:42:17

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!