Jump to content

Why scene.pickInfo(...).pickedMesh is not working, when camera.maxZ is very large number?


Recommended Posts

I need to create very large scene (there are meshes with size 10, but also with 10^6). It requires set:

camera.maxZ = Math.pow(10, 10)

But then is not working pickedMesh (pickedMesh is always null):

scene.pick(scene.pointerX, scene.pointerY).pickedMesh

Is there any way to use very large camera visibility with functional pickedMeshHere is demo.

Link to comment
Share on other sites

good question.  I tried your PG with a couple of changes to see if it would make a difference, but it didn't:

It works till distance 3350000 and not at 3360000, although not very accurate at that distance.  I have noticed this before with BABYLON.Ray(), which defaults to 100.  I wonder if it is some optimisation, but I can't find it.

Link to comment
Share on other sites

We are hitting a math limitation here

I would highly suggest to create your scene with smaller number and just apply a function to move from the 3d representation to the data world

For instance if in your simulation a mesh has to be a 10^7 then just consider that it will be at 10^3 so the function to move from one world to another is x / 10^4

Link to comment
Share on other sites

@Deltakosh Thanks for answer, but I have another problem with this. I need render our galaxy Milky Way and our planet Earth abreast. Milky Way has diameter 100 000 light years (it's 946 100 000 000 000 000 km), and Earth has diameter 12 756 km.

So, when Milky Way is 10^5 Babylon's size-units long, my function is x / 10^14. Then Earth must have 10^(-9) Babylon's size-units. Unfortunately, Earth is not visible (even if I zoom it), and if I set:

camera.minZ = Math.pow(10, -9)

there is same problem as when I set big maxZ - pointer events are not called on mesh.

Any idea how to do this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...