# JME3 will Blender/j3o Objekte nicht einladen



## ambarek (28. Jul 2012)

Ich habe volgenden Code Programmiert:


```
package core.main;


import com.jme3.asset.AssetManager;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.joints.HingeJoint;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;


public class Brett {
    private static HingeJoint Brett0;
    public static PhysicsSpace space;
    public static AssetManager assetManager;
    public static Node Brett;
    public static Node rootNode;
    public static void initBrett(float x , float y , float z ){ 
        
        Node Brett_1=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f( .254f, .987f, .119f)),1);
        Brett_1.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f + x,0f,0f));//Links Unten (0,0)
        
        Node Brett_2=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_2.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,0f,0f));//Mitte Unten (0,1)
        
        Node Brett_3=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_3.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,0f,0f));//Rechts Unten (0,2)
        
        Node Brett_4=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_4.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f+ x,2.609207f,0f));//(1,0)
        
        Node Brett_5=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_5.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,2.609207f,0f));//(1,1)
        
        Node Brett_6=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_6.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,2.609207f,0f));//(1,2)
        
        Node Brett_7=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_7.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f+ x,5.230207f,0f));//(2,0)
        
        Node Brett_8=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_8.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,5.230207f,0f));//(2,1)
        
        Node Brett_9=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_9.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,5.230207f,0f));//(2,2)
        
        Node Brett_10=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_10.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f+ x,7.885207f,0f));//(3,0)
        
        Node Brett_11=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_11.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,7.885207f,0f));//(3,1)
        
        Node Brett_12=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_12.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,7.885207f,0f));//(3,2)
        
        Node Brett_13=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_13.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f+ x,10.506207f,0f));//(4,0)
        
        Node Brett_14=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_14.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,10.506207f,0f));//(4,1)
        
        Node Brett_15=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_15.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,10.506207f,0f));//(4,2)
        
        Node Brett_16=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_16.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f+ x,13.136207f,0f));//(5,0)
        
        Node Brett_17=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_17.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.48373f+ x,13.136207f,0f));//(5,1)
        
        Node Brett_18=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.254f, .987f, .119f)), 1);
        Brett_18.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.97573f+ x,13.136207f,0f));//(5,2)

        
        Brett0 = new HingeJoint(Brett_1.getControl(RigidBodyControl.class),
                                Brett_2.getControl(RigidBodyControl.class),           
                                new Vector3f(0f+ x,0f,0f),
                                new Vector3f(.48373f+ x,0f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_3.getControl(RigidBodyControl.class),
                                Brett_4.getControl(RigidBodyControl.class),           
                                new Vector3f(.97573f+ x,0f,0f),
                                new Vector3f(0f+ x,2.609207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_5.getControl(RigidBodyControl.class),
                                Brett_6.getControl(RigidBodyControl.class),           
                                new Vector3f(.48373f+ x,2.609207f,0f),
                                new Vector3f(.97573f+ x,2.609207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_7.getControl(RigidBodyControl.class),
                                Brett_8.getControl(RigidBodyControl.class),           
                                new Vector3f(0f+ x,5.230207f,0f),
                                new Vector3f(.48373f+ x,5.230207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_9.getControl(RigidBodyControl.class),
                                Brett_10.getControl(RigidBodyControl.class),           
                                new Vector3f(.97573f+ x,5.230207f,0f),
                                new Vector3f(0f+ x,7.885207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_11.getControl(RigidBodyControl.class),
                                Brett_12.getControl(RigidBodyControl.class),           
                                new Vector3f(.48373f+ x,7.885207f,0f),
                                new Vector3f(.97573f+ x,7.885207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_13.getControl(RigidBodyControl.class),
                                Brett_14.getControl(RigidBodyControl.class),           
                                new Vector3f(0f+ x,10.506207f,0f),
                                new Vector3f(.48373f+ x,10.506207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_15.getControl(RigidBodyControl.class),
                                Brett_16.getControl(RigidBodyControl.class),           
                                new Vector3f(.97573f+ x,10.506207f,0f),
                                new Vector3f(0f+ x,13.136207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        Brett0 = new HingeJoint(Brett_17.getControl(RigidBodyControl.class),
                                Brett_18.getControl(RigidBodyControl.class),           
                                new Vector3f(.48373f+ x,13.136207f,0f),
                                new Vector3f(.97573f+ x,13.136207f,0f),                              
                                Vector3f.UNIT_Z,
                                Vector3f.UNIT_Z);
        
               
        Spatial Brett_Rand = assetManager.loadModel("Models/Brett/Brett_Randteil.j3o");
        Brett_1.attachChild(Brett_Rand);
        Brett_2.attachChild(Brett_Rand);
        Brett_3.attachChild(Brett_Rand);
        Brett_16.attachChild(Brett_Rand);
        Brett_17.attachChild(Brett_Rand);
        Brett_18.attachChild(Brett_Rand);
        Spatial Brett_Mitte = assetManager.loadModel("Models/Brett/Brett_Mitte.j3o");
        Brett_4.attachChild(Brett_Mitte);
        Brett_5.attachChild(Brett_Mitte);
        Brett_6.attachChild(Brett_Mitte);
        Brett_7.attachChild(Brett_Mitte);
        Brett_8.attachChild(Brett_Mitte);
        Brett_9.attachChild(Brett_Mitte);
        Brett_10.attachChild(Brett_Mitte);
        Brett_11.attachChild(Brett_Mitte);
        Brett_12.attachChild(Brett_Mitte);
        Brett_13.attachChild(Brett_Mitte);
        Brett_14.attachChild(Brett_Mitte);
        Brett_15.attachChild(Brett_Mitte);
        
        
        
        com.jme3.bullet.PhysicsSpace.getPhysicsSpace().add(Brett);
        
        Brett.attachChild(Brett_1);
        Brett.attachChild(Brett_2);
        Brett.attachChild(Brett_3);
        Brett.attachChild(Brett_4);
        Brett.attachChild(Brett_5);
        Brett.attachChild(Brett_6);
        Brett.attachChild(Brett_7);
        Brett.attachChild(Brett_8);
        Brett.attachChild(Brett_9);
        Brett.attachChild(Brett_10);
        Brett.attachChild(Brett_11);
        Brett.attachChild(Brett_12);
        Brett.attachChild(Brett_13);
        Brett.attachChild(Brett_14);
        Brett.attachChild(Brett_15);
        Brett.attachChild(Brett_16);
        Brett.attachChild(Brett_17);
        Brett.attachChild(Brett_18);
        
        rootNode.attachChild(Brett);
    }

}
```

Leider kommt immer diese Fehlermeldung:
	
	
	
	





```
run:
Jul 28, 2012 9:39:50 PM com.jme3.system.JmeSystem initialize
Information: Running on jMonkeyEngine 3.0.0 Beta
Jul 28, 2012 9:39:50 PM com.jme3.system.Natives getExtractionDir
Warnung: Working directory is not writable. Using home directory instead.
Jul 28, 2012 9:39:50 PM com.jme3.system.Natives extractNativeLibs
Information: Extraction Directory: C:\Users\SKD\.jme3\natives_d6d996d4
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglAbstractDisplay run
Information: Using LWJGL 2.8.1
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglDisplay createContext
Information: Selected display mode: 1023 x 703 x 0 @0Hz
CEGUI::InvalidRequestException in file ..\..\..\cegui\src\CEGUIDefaultResourceProvider.cpp(103) : DefaultResourceProvider::load: C:\Program Files (x86)\TeamSpeak 3 Client\plugins\ts3overlay\styles\java.scheme does not exist
CEGUI::InvalidRequestException in file ..\..\..\cegui\src\CEGUIDefaultResourceProvider.cpp(103) : DefaultResourceProvider::load: C:\Program Files (x86)\TeamSpeak 3 Client\plugins\ts3overlay\styles\fonts\arial.ttf does not exist
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: Adapter: vm3dum64
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: Driver Version: null
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: Vendor: VMware, Inc.
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: OpenGL Version: 2.1 Mesa 7.11-devel
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: Renderer: Gallium 0.4 on SVGA3D; build: RELEASE; 
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
Information: GLSL Ver: 1.20
Jul 28, 2012 9:39:50 PM com.jme3.system.lwjgl.LwjglTimer <init>
Information: Timer resolution: 1.000 ticks per second
Jul 28, 2012 9:39:51 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
Information: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120, NonPowerOfTwoTextures, VertexBufferArray]
Jul 28, 2012 9:39:51 PM com.jme3.asset.DesktopAssetManager <init>
Information: DesktopAssetManager created.
Jul 28, 2012 9:39:51 PM com.jme3.renderer.Camera <init>
Information: Camera created (W: 1.023, H: 703)
Jul 28, 2012 9:39:51 PM com.jme3.renderer.Camera <init>
Information: Camera created (W: 1.023, H: 703)
Jul 28, 2012 9:39:51 PM com.jme3.input.lwjgl.LwjglMouseInput initialize
Information: Mouse created.
Jul 28, 2012 9:39:51 PM com.jme3.input.lwjgl.LwjglKeyInput initialize
Information: Keyboard created.
Jul 28, 2012 9:39:51 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
Information: AudioRenderer supports 64 channels
Jul 28, 2012 9:39:51 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
Information: Audio effect extension version: 1.0
Jul 28, 2012 9:39:51 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
Information: Audio max auxilary sends: 4
Jul 28, 2012 9:39:51 PM com.jme3.material.MaterialDef <init>
Information: Loaded material definition: Unshaded
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Gui Node)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Statistics View)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (Statistics View) attached to this node (Gui Node)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (BitmapFont) attached to this node (null)
Jul 28, 2012 9:39:51 PM com.jme3.scene.Node attachChild
Information: Child (null) attached to this node (Gui Node)
Jul 28, 2012 9:39:51 PM com.jme3.app.Application handleError
Schwerwiegend: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
	at core.main.Brett.initBrett(Brett.java:141)
	at core.main.main.simpleInitApp(main.java:73)
	at core.main.StartF.initialize(StartF.java:236)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
	at java.lang.Thread.run(Thread.java:722)

Jul 28, 2012 9:39:51 PM com.jme3.renderer.lwjgl.LwjglRenderer cleanup
Information: Deleting objects and invalidating state
Jul 28, 2012 9:39:51 PM com.jme3.input.lwjgl.LwjglMouseInput destroy
Information: Mouse destroyed.
Jul 28, 2012 9:39:51 PM com.jme3.input.lwjgl.LwjglKeyInput destroy
Information: Keyboard destroyed.
Jul 28, 2012 9:39:51 PM com.jme3.system.lwjgl.LwjglAbstractDisplay deinitInThread
Information: Display destroyed.
```

Ich bitte um hilfe!


----------



## Empire Phoenix (29. Jul 2012)

Spatial Brett_Rand = assetManager.loadModel("Models/Brett/Brett_Randteil.j3o");
        Brett_1.attachChild(Brett_Rand);
        Brett_2.attachChild(Brett_Rand);

geht nicht, da hast du eine misconzeption wie der assetmanager shared. Ich empfehle die wiki auffer jme seite dazu zu konsultieren. Ob dass jetzt der grund für den nullpointer weiß ich allerdings nicht. (welche zeile ist denn die 114?)

Ansonsten empfehle ich dir GANZ DRINGEND java conventionen durchzulesen und zu verwenden. da der code so sehr schwer lesbar ist. ausserdem ist es vorteilhaft englishe variablenamen zu verwenden.

Ansonsten vonner eihenfolge
Object laden mit assetManager
physic initialisieren fürs object
dannach erst hinges ect machen do vorher keine physic existiert womit die arbieten könnten.


----------



## Marco13 (29. Jul 2012)

In Zeile 114 wird etwas derefernziert, was 'null' ist. LESEN werde ich den Code nicht ( :autsch: ) , aber... beim Überfliegen steht dort überall
       Brett0 = new ..
sollte das nicht auch mal 
       Brett_IrgendeineAndereZahl_ = new ...
sein? (Oder vielleicht mal unter Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics) schauen... )

EDIT:   :roll: nichtmal um 3:00 kann man sich beim Antworten ein paar Minuten Zeit lassen, OHNE dauernd "reload" zu drücken :autsch:


----------



## Matthias K. (5. Aug 2012)

Hi, 
ich hatte euch meine Probleme Objekte aus Blender in die JME einzubinden. 
Der Plugin mit den j3o-Files macht zu Beginn einen guten Eindruck, aber ein paar Objekte später merkt 
man, dass er Probleme macht: schlechte Texturequali etc.
Du solltest ogreXML benutzen. Dabei funktioniert alles super bis auf ein paar Dinge bei den neueren Blenderversionen. Diese Probleme kann man aber beim Export der Objekte verhindern, indem man Seperate Materials ausstellt.

Ich habe immoment meinen Exporter nicht zur Verfügung, aber vielleicht findest du ja alles was du 
brauchst hier:
Ogre Forums &bull; View topic - Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]
und bei den Tutorials der JME.


----------

