Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  general problems with loading models :X  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
Offline Steff

Junior Newbie





« Posted 2011-11-22 13:28:31 »

Hello ppl,
I am new here.. i saw many useful things in this forum (thank you), but i have some problems with loading 3d models and i could not find posts about them Undecided

I'm trying to make some simple "game", at the moment i have Oto model loaded + some keys to animate the walking and dodging animation + simple terrain to move on it Smiley
(Using JME3, Oto model and the tutorials i found about JME3)

I have problems with finding that Oto model (win 7) i searched everywhere for it and couldn't find it Sad - Can someone point where he is ? Cheesy
If i can see how the things work with that model i can make my own models work too (copycat ^^ )

 Huh The real problem for me is how to load my own models. I am talking about file formats and how to make it work.
for example I can make models on Maya. What format should i export from Maya? Do i need to work on it with some other software so that i can import them in Java and actually move them there?
Ask if you cant catch my thoughts.

Here is samples from my game source for basic scene. I don't wanna paste whole code here because it will be too confusing Tongue + feel free to use it if u want. It is made for education purposes. Smiley

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
{import's from jme3}

public class aHelloSteffMakeUp extends SimpleApplication implements AnimEventListener {
   
     
   public static void main(String[] args){
      aHelloSteffMakeUp app = new aHelloSteffMakeUp();
        app.start(); // start the game
        }

   Node golem;
   
   /** golem'
s coordinates*/
   float xGolem;
   float yGolem;
   float zGolem;
   float scaleGolem;
   {
    /* golem's starting place*/
        scaleGolem = 0.2f;
        xGolem = -40;
        yGolem = 1;
        zGolem = 0;
   }

    static{
          /** Initialize the floor geometry */
          floor = new Box(Vector3f.ZERO, 50f, 0.1f, 50f);// shiro4ina viso4ina dyljina
         floor.scaleTextureCoordinates(new Vector2f(50, 50));    
    }


    public void simpleInitApp() {
/** Set up Physics Game */
        bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);
       
/** Configure cam to look at scene */
        cam.setLocation(new Vector3f(-50f, 5f, 0f));
        cam.lookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
       
        initMaterials();
        initFloor();
        shootables = new Node("Shootables");                    //not needed  
       rootNode.attachChild(shootables);                           //not needed
       shootables.attachChild(makeCube("a tin can", xGolem, yGolem+3, zGolem));     //not needed
       shootables.attachChild(initFloor());   //not needed
       
        /** za animacii ***************************************************************************/
        initKeys(); //not needed
       initSun();
        initGolem();
        initCrossHairs(); //not needed
       initMark();       // a red sphere to mark the hit //not needed
       viewPort.setBackgroundColor(ColorRGBA.randomColor());
       
       
    };


   
 /** Initialize the materials used in this scene. *****************************************/
    public void initMaterials() {
       floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        TextureKey key3 = new TextureKey("Textures/Terrain/splat/grass.jpg");
        key3.setGenerateMips(true);
        Texture grass = assetManager.loadTexture(key3);
        grass.setWrap(WrapMode.Repeat);
        floor_mat.setTexture("ColorMap", grass);
    };



/** MAKE THE GOLEM */
    public void initGolem(){
       golem = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
        golem.setLocalScale(scaleGolem);
        golem.move(xGolem,yGolem,zGolem);
        golem.lookAt(new Vector3f(0f,0f,0f), new Vector3f(0f,0f,0f));
        rootNode.attachChild(golem);
       
        /** Make golem physical with a mass > 0.0f. */
        golem_phy = new RigidBodyControl(2f);
        /** Add physical golem to physics space. */
        golem.addControl(golem_phy);
        bulletAppState.getPhysicsSpace().add(golem_phy);
 
        control = golem.getControl(AnimControl.class);
        control.addListener(this);
        channel = control.createChannel();
        channel.setAnim("stand");
    };

   /** ADD SUN so we can see the golem*/
    public void initSun(){
       DirectionalLight dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
        rootNode.addLight(dl);
    };
}



If u cant understand something or need more feedback with the things pls ask Smiley
Any information given will be great Smiley
Thank you in advance! Cheesy
Offline tensei

Senior Newbie


Medals: 3



« Reply #1 - Posted 2011-11-23 12:00:44 »

You can find the Oto model here (along with most of the other assets used in the tutorials). Im not sure if the tutorials are up to date, because it seems that the assets are packed in another place in the newest version. I have not searched thoroughly though, so I might be wrong.

As to loading models, I know that they atleast support Ogre XML and Wavefront OBJ, so you should try export to one of those formats. See here. Also if you look at the "External Tools" section here, you'll see a couple of tutorial videos on creating and exporting from 3D modelling tools.
Offline Steff

Junior Newbie





« Reply #2 - Posted 2011-11-25 08:48:56 »

You can find the Oto model here (along with most of the other assets used in the tutorials). Im not sure if the tutorials are up to date, because it seems that the assets are packed in another place in the newest version. I have not searched thoroughly though, so I might be wrong.

As to loading models, I know that they atleast support Ogre XML and Wavefront OBJ, so you should try export to one of those formats. See here. Also if you look at the "External Tools" section here, you'll see a couple of tutorial videos on creating and exporting from 3D modelling tools.

Thank you for the fast replay and the hints Smiley)

As far as it goes i can load only OBJ files and i load them only in JME3 Smiley
I tried to load the same obj in Eclipse but there was a not found exception. I tried to move the obj file everywhere in my eclipse project dir. (no success)

About the Ogre XML file format I cant do much .. Maya exports .mesh files (with ogre's plug-in) but it seems that i need them in .mesh.xml format (right?) persecutioncomplex I export binary, not ASCII mesh files :/


I might do it wrong way .. dunno :| but I wont give up till I make it how it needs to be Smiley

JME3 are making a book,manual for it but there is no release date. I may wait for it ( Cheesy ). I will make the tutorials here and I'll replay if I find solution.

Thank you again! Smiley
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.

BurntPizza (13 views)
2014-09-19 03:14:18

Dwinin (31 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (79 views)
2014-09-10 06:39:09

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!