[UPDATED] Strange behavior with WorldBounds/ModelBounds and Intersect – please help

Hello everybody,



I recently started working on a new project, where I am supposed to process 3Dmodels that represent street networks (see picture). I am so far able to load those jme models (exported from Blender via HottBJ) in my Java application.







The next step is to see where there are road meshes in the map, and, while working on this, I discovered some strange behavior. My first idea was to send array through the 3D world and see where it intersects with any Geometry objects.

However, this did not work at all. For example, if I start a horizontal ray with vector (1,0,0) from map position (0,0,0) (the center of the square grid in the lower middle quadrant in the picture above), the intersection results contain objects that are NEVER ever to be expected to intersect with the given ray.

More confusingly, if I rotate the ray by 90 degrees, I do not get any results at all, although there should occur some intersections.



All in all, the problem is difficult to explain, which is why I have attached two Java code demos. The demos can be found at: http://tinyurl.com/3ddemofiles. The demo files read in a binary jme model that can be found at: [link removed]. I also added the original blender file, so you can see how the single objects are located within the 3D world. Please not that the model files package is about 10MB in size, due to the textures.



In demo1, I simply send out the ray and see whether it intersects with the World Bound of any object in the 3D world.

demo2 takes a slightly different approach, by creating a Box object that is moved into the expected position of each world object by performing translations and rotations on it, and then intersected with the ray.



Both approaches do not yield the expected results. It seems that, while the 3D world gets drawn directly on the screen, the single Geometry objects cannot be found where they appear to be.

I have been meddling for the last week now, and I can’t seem to get it to work. Time starts running out, and I am somewhat desperate here, so I greatly appreciate any ideas. If you have further questions, please DO ask.



I am using JME2, the model files are generated in Blender (not sure which version, though) and exported with hottbj v0.4.



Thanks in advance,

Markus

Try doing an updateModelBound() on the spatials you want to intersect. jME2 has some problems updating stuff properly at times…

Thanks Normen, I will give it a shot. Isn’t this more or less what is done in demo2?



EDIT: I had to take down the model file due to licensing issues. I will try to come up with other data that shows my problem.

Hi again,



I came up with what I think is a quite minimal example for the problem that I am facing:





In this simple world, there are 3 blocks. The block in the middle is not just larger than the other two, it has also been rotated 90° on the Z-Axis.



If I now send a ray from (0,0,0) in direction (1,0,0), I get positive intersection results for the small blocks to the left and to the right. However, I do NOT get an intersection for the larger block in the middle!



I honestly don’t know what else to try. Normen, I have followed your advice and called the updateBounds methods some more times for good measure. Could somebody please please have a look at this? I need this to work in order to make progress with my master thesis, so I would be most thankful to anybody who can provide me some help here.



I created a new, more concise demo file that can be found here.

The jme file can be found here. No textures this time, so small files and no hassle.

You might have to adjust the path to the jme file in the demo, according to your working environment.

Seems like picking is still bugged :confused:

I made a TestMousePick test for this, so I confirmed it.

Thanks Momoko_Fan for confirming.

So, which alternatives do I have? Does picking work better in jme3? If so, I could switch to using that.

Oh you’re using jME2? I wasn’t aware.

Looks like both engines have broken picking XD