You cannot register a locator for a single file, only for a folder. Also, for a Folder you’d have to use a FileLocator and not a ClasspathLocator…
I’m no expert in Eclipse but I am pretty sure I added the assets folder to my project classpath.
note that the trace shows:
[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.asset.AssetNotFoundException: Models/F_Drive.mtl[/java]
instead of F_Drive.obj (what I called my object)
I also edited the Jme3Test.jar added my obj file to it and STILL it does not find it :S
You added the OBJ but you didn’t add the MTL
ok that make sense… I didn’t know i need to have both but now I am getting this trace. the test 2 is still null
[java]NFO: Child (null) attached to this node (Gui Node)
Test1:jar:file:/C:/Users/garnaout/Desktop/My%20Work%2032/jME3_08-04-2011/jMonkeyEngine3.jar!/com/jme3/math/Vector3f.class
Test2:null
Sep 14, 2011 10:13:28 PM com.jme3.material.MaterialDef <init>
INFO: Loaded material definition: Phong Lighting
Unknown statement in OBJ! o
Sep 14, 2011 10:13:28 PM com.jme3.scene.plugins.OBJLoader createGeometry
WARNING: OBJ mesh F_Drive-geom-0 doesnt contain normals! It might not display correctly
Sep 14, 2011 10:13:28 PM com.jme3.scene.Node attachChild
INFO: Child (F_Drive-geom-0) attached to this node (F_Drive-objnode)
Sep 14, 2011 10:13:28 PM com.jme3.scene.plugins.OBJLoader createGeometry
WARNING: OBJ mesh F_Drive-geom-1 doesnt contain normals! It might not display correctly
Sep 14, 2011 10:13:28 PM com.jme3.scene.Node attachChild
INFO: Child (F_Drive-geom-1) attached to this node (F_Drive-objnode)
Sep 14, 2011 10:13:28 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ClassCastException: com.jme3.scene.Node cannot be cast to com.jme3.scene.Geometry
at com.kiva.sim.animation.Jme3Cinematics.create3dDrives(Jme3Cinematics.java:445)
at com.kiva.sim.animation.Jme3Cinematics.createScene(Jme3Cinematics.java:387)
at com.kiva.sim.animation.Jme3Cinematics.simpleInitApp(Jme3Cinematics.java:126)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:230)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:124)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)
at java.lang.Thread.run(Unknown Source)[/java]
is there anything special I need to do in Blender?
The error is in your code, you try to cast a Node to Geometry.
Normen, my only node is the whole project is the rootNode. I cast a spatial to geometry:
Geometry geo = (Geometry) spatial_from_blender; // if I replace my spatial.obj with something I already have like Models/TeaPot.obj the program works fine.
Update:
Ok I really don’t get this
why when I write
[java]
spatial_from_blender = assetManager.loadModel(“Models/Teapot.obj”);
Geometry geo = (Geometry)spatial_from_blender; // this works[/java]
and
[java]
spatial_from_blender = assetManager.loadModel(“Models/myspatial_ver2.obj”);
Geometry geo = (Geometry)spatial_from_blender; // this throws an error
[/java]
looks like the problem is from Blender. Any hints on what I did wrong from there? my model is REALLY simple. Two Metaballs attached and each has a different color.
Normen already said it. You try to cast something that is not a geometry into a geometry. This is basic Java programming and is not related to blender
Sorry to get back to this but how does the sizing exactly works between blender and Jme?
let’s say I have a spatial created in blender in dimensions (1.450, 0.905, 0.304) from actual size 1450mm 905mm 304mm. The shape looks fine in the model when imported.
However the animation is connected to a simulation framework where everything is in mm and looks like the object is too small compared to the simulation. How can I make sure that the size of the spatial created in Blender and imported to Jme is the actual size in mm.
There is no “actual size” unless you use physics where 1m = 1unit. Units between blender and jme3 are translated 1:1. The apparent visual size only depends on relative sizes between objects and camera location really.
Then how would be to animate an event like:
[java]move spatial_1 to position (4493.0, 0.0, 48263.0) in a duration of (36.86701013131995) from position (0,0,0)[/java]
with a spatial of size (1.450, 0.905, 0.304) vs. a size of (1450, 905, 304)
well the duration wouldn’t change bit the location would be multiplied / divided by 1000
that makes sense. Ok just one more thing:
how can I make sure the blender object is placed facing the right direction. Say the spatial created in Blender is rectangular. In Jme I can tell it to be placed at (0, 0, 0) but not where it’s facing right?
to be more clear
Ex: I am trying to have the car (Rectangle shaped) hit the square so it has to rotate then move to hit it. My rotation will change depending on the how the spatial is placed in the scene. I know I could initially rotate it in Blender but how can I synch both of them? I want the object from blender to be created in jme at (0,0,0) - DONE and initially rotated in Jme like this (on a 2D axes):
does that make sense?
and this might be an important clarification:
I am trying to animate a previously done 2D simulation. I replaced the y axis with z so a A(1,2,0) is now A(1,0,2) in my implementation
That works Flawlessly , thankyou