Jump to content

How to draw Ellipse2D responsive respact to screen size(window size).


Recommended Posts

Using ScreenSpaceCanvas2D i draw one Ellipse2D around my mesh.

Now i want to set its property such a way that when windows size is changes Ellipse position respect to mesh remain same.some thing like responsive.

Please help me...!!!!!!!!!!!!!!!!!

Link to comment
Share on other sites

Hi guys.  I tried an experiment... https://www.babylonjs-playground.com/#18AMT4#6

Using a WorldSpaceCanvas2d with ellipse2d, I rotated, postioned, and parented its worldSpaceCanvasNode (the mesh that worldspacecanvas2d's are painted-upon).

See lines 59-64.  It works.  No border allowed on ellipse2d apparently... but not sure.  Also, these don't do well on bumpy terrains, as you can see.  Might as well use a plane with a circle texture on its standardMaterial, eh?  Better resolution with a plane and circle texture.

BUT, this method, and a plane-with-circle-texture... will do fine on window/canvas resizes.  No problems there.  It is a work-around.  Not sure if these things will work for you, Brijesh, but... perhaps a temporary solve until Nockawa can do some tests, later.

Link to comment
Share on other sites

Hiya @Nockawa.  Just to speed things up a bit, he is probably ellipse2d- encircling a mesh (with screenspace ellipse2d), using group2d trackedNode.  The Ellipse is probably not tipped-down to match ground, like mine is. 

ScreenSpace mesh-tracking Group2d's are staying properly aligned... after canvas/window resizings... in your test cases, right N?

I think that is what BriJesh is saying.  Tracknode prims not staying aligned with mesh after resize. 

But maybe, he only "placed" the ellipse on the screen at the proper place to encircle the mesh, and is not setting trackedNode AT ALL.

Ok, I'll shut up, now.  I'm getting into EVERYONE ELSE'S business, today, for some reason.  :)  (Wingnut hears someone in the crowd yell "EVERY day!").  heh

Link to comment
Share on other sites

Hey, thanks for the better ellipse edges and general cleanup!  COOOOOL!


I wanted to edit my "snippy" comments in this PG's "description" metadata field, but no edit. It came out of my fingers, and now I have to live with it... I have to sleep in the bed I made.  heh.

THIS kind of ellipse-encirclement is what I think B-man is doing... screen-tracking a mesh.  I think he had no trackNode set on his Group2d, or maybe no Group2d to do trackNode-with. 

This does screen resizings just fine, well done on that, N.  I wish center of prim == center of mesh automatically, without fiddling with stuff.  We'll talk.  :)

See my ellipse scaler based-on camera radius (for mousewheeling)... in the renderLoop?  It works exactly backwards.  I couldn't make my mind think-up how to reverse it.  I'm too doped-up this late in the day.  heh.  Help welcomed. 

Thanks again for response, and fixings, Noxxy.  Love ya, man!  :)  Brijesh definitely has some toys to play-with, now... and fresh knowledge about worldspace's trackNode, and Group2d's trackNode.  I think both features are excellent.

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