Loading a particular *.OBJ breaks the code

I’m trying to place a marker (loading a sphere object) by clicking on the surface of a model in the scene.

The program works as expected with one *.obj file but not with another. AFAIK there is nothing remarkable about either file. The problematic file was generated using a 3D scanner and then downsampled in Blender.

Attached is my code and the *.obj files in question. To load the working model comment out 106-107 and uncomment lines 109-110, vice versa for the problematic model.
pandascene.zip (1.46 MB)

The difference has to do with the relative scales. You are using this to get the position:

point = collEntry.getSurfacePoint(collEntry.getIntoNodePath())

This however gets the point relative to the node’s coordinate system, which has a scale applied. You are then using it to position the marker on “render”.

You should instead get the position in “render” coordinate space, since you will use it to position objects in the “render” coordinate space also:

point = collEntry.getSurfacePoint(render)

Also, you could try “baking” the scale into the model, by calling flattenLight() just after you call setScale.

That works, thank you!