[New] Trouble when check the picking results & [SOLVED] Trouble in putting many models(will be operated) together

Yes you can. You can get it from the application.

(I’m putting as much effort into my answers as you do into your questions so this could take a while.)

You should really do ALL of the basic tutorials, though. Save you man-weeks of time in the end.

You should open the JME javadoc and keep it open.

Look in there for answers “How do I get the application from my BaseAppState?” It’s in the javadoc. “How do I get the asset manager from the application?” It’s in the javadoc.

Maybe I can write a grid component (contains assetmanager & listener) which extends SimpleApplication and then manage them in my BaseAppStates?

OK, I’ll do that

How many applications do you want in your application and will they have applications and will those applications have applications?

Just one SimpleApplication per application.

From any BaseAppState:
getApplication().getAssetManager().loadModel(…)

…but if these are the things you struggle to find you are in for a long road. So keep the javadoc open all the time. Do the tutorials. Look for game examples to learn from. And so on.

As the others said, do the tutorials, all of them, you will learn a bunch from it. Then when you have a problem, write a simple one class application and load there your what ever you want to load and paste that code in the forum and ask why it is not working. for now it’s for all here fishing in the dark as we do not see what you see.

I got a problem when I load my model, I find that I can’t convert the blender file to j3o in my SDK. Could tell me what is happening and any solutions? Or anyone could help me to convert that to be a model that can be solved by AssetManager?

the file :
3D-MineSweeping/main/resources/Models/Grass at main · BAO-Jiale/3D-MineSweeping (github.com)

1 Like

What does that mean? There is no option? You get an error? What’s the error?

.blend is not a well supported format as it will break every time a new version of blender comes out. Currently only 2.79 is supported I think.

You should load it into blender and export it as GLTF. GLTF will import into JME. So you should use GLTF.

Probably you should just export in GLTF and use that.

You’re using Blender’s particle system (hair) to create grass. It won’t be imported to jME even on Blender 2.79, which is the last version with jME support. It won’t be exported to glTF either.

You should read the how to model tutorial first. The glTF entry in Blender’s manual is also important.

2 Likes

Thanks for your advice. Problem solved

1 Like

Now I got a new question. How can I check the collision result (Geometry) is on my “shootable” list (with Spatial)? Since I got to return the spatial that I open/marked by the crosshair when click my mouse button.

I only know the ray casting from the beginner tutorial. They only check geometry with geometry. And in the node tutorial I know that the geometry extends spatial, but what can I do to get it back or just to check the belongings?

Also, when I use geometry.getParent, the method will leads to Rootnode, thus the checking breaks down.

Could you help me with the new problem I updated below?

I’ve answered similar questions like it probably 100 times on the forum. You can probably search for them.

Or just use Lemur’s built in scene picking and don’t worry about it.

any key words plz?

If you attach :

  • Geometry A – setName(“GeoA”);
  • Geometry B – setName(“GeoB”);
  • Geometry C – setName(“GeoC”);

To : Node A --setName(“NodeA”);

Then, NodeA to rootNode,

At Collision :

if you want to fetch the children of NodeA, just do nodeA.getChildren() then use foreach to iterate over children one by one, if you want to get one geometry only, just do ((Node)rootNode.getChildByName("NodeA")).getChildByName("GeoA");

Look for Node java docs, you will find it much easier.

But in the collision result, I’ll search for the closest, therefore I got only one geometry. Then I need to check whether the closest result (only one geometry) is on any Spatial in the shootable list (many spatials), so the your node A should be my “shootable”, however the spatials are also in that. So how can I do that?

1 Like

What do you mean by closest ? Closest in distance ?!

Yeah, the closest with my camera

  • Loop over the children of the proposed Node using node.getChildren() & an enhanced for-loop.
  • Check for each subNode or subSpatial if it’s nearest or far from a target site using subNode.getLocalTranslation().distance(cam.getLocalTranslation()) which retruns float.

Here’s an example :

nodeA.setOnCollision( (obj1, obj2) -> {

if(obj1.getName().equals("NodeA")){
    for(Spatials child : obj1.getChildren()){
          if(child.getLocalTranslation().distance(cam.getLocalTranslation()) < 100f){
                  //To-do something special.......
           }
      }

}
});

refer to Vector3f docs to learn more…

Are you actually asking how to get the parent of the collision result?

(hint: getParent())
…or?

As for keywords, I don’t know… maybe “CollisionResult” and “pspeed”. I wrote Lemur so people don’t have to deal with this stuff on their own every time. Just add a listener to the spatial that gets called when the user clicks on it.