Jump to content

How to translate a mesh(scene) coordinate into the html document ?


elkyu
 Share

Recommended Posts

Hi !

 

I have that : http://www.babylonjs-playground.com/#272WDW#14

 

Actually the image is in the scene behind the plane (material on a plane)

 

What I want it's put that image in html directly, behind the canvas.

 

I currently I get all the coordinates of all points which make the hole. And with that I calculate the center of the hole to place the image there.

 

But I don't know how we can translate the coordinate of the hole center into the html document ?

Link to comment
Share on other sites

After giving that a thought I don't think it will work like that. If you place the image directly on html you cant really zoom in using babylon. You know what I mean? The camera doesnt move closer to the html. It just moves in the virtual 3D space. If the images are not in that same 3D space, I don't think you can zoom on them by moving the camera... at least that's how I imagine it :P

Link to comment
Share on other sites

So, to make this clear, you'll have to simulate the zoom effect on the image by modifying the image's attributes (position, size) along the way.

 

Are you sure you need to mix HTML and WebGL here? I mean, once the zoom animation is over, your WebGL canvas is pretty much your image.

 

If you're sure you're going with that, then it's just a matter of creating an img element and animation its attributes. JQuery does that easily:

var img = $("<img>").appendTo("body").offset( {top: 100, left: 200} );img.animate({top: 0, left: 0}, 2.0, function() { });

Edit: iiceman explains it better :)

Link to comment
Share on other sites

with the solution provided in the other topic I don't need to do this, yes, but I'd still like to know how to do this , it might serve me in the future. Not necessarily to zoom in on the image.
It's just for satisfy my curiosity :rolleyes:  (that's why I created an other topic) 

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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