Jump to content

Camera and right distance to view an object


Recommended Posts

Hello everyone!


As you can see here,




there's a little demo with all the features I need right now from BabylonJS...


For example, you can click on an element in the 3d scene or in the table on the right, and it becomes selected, both in 3d and in the table...


My question is... how much can i "zoom" to the selected mesh and keep it into view? I mean, I want very vertice of the mesh visible...


Thank you in advance!


P.S: If you have some tips about my code, don't hesitate to tell me! (Everything is in the index.html code) or general comments!

Link to comment
Share on other sites

Hello Deltakosh,


I have a question about the function you created...


1) Where do I have to use it?


From what I understand, I should use it in the scene.registerBeforeRender and if the function returns false, i call the .stop () function on the animatable returned by the scene.beginAnimation...


But doing so, I'd have, for every frame, an if that evaluates the mesh, even if there is no mesh to evalutate because I am not animating anything...


I mean, something like this:

if (mesh != null)      if (mesh.isCompletelyInFrustum () == false)           animatable.stop ();

Do you think would be possible to add a callback in the Animation like .onTick () that if returns false, stops the animation?


Or there are other ways?


2) Can I pass an array of meshes to the function, or only one?


Thanks in advance!

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...