Jump to content

Finding four nearest corners of a sphere's bounding box and project them into screenspace?


StarToaster
 Share

Recommended Posts

http://www.babylonjs-playground.com/#N9MYJN#3

The projection was fine, just needed to not center the text (i.e. not set margin alignment to center), and translate the y coord from screen coords to canvas2d coords (canvas2d has the origin at the bottom left as opposed to the top left).

Also needed to get the closest corners I needed to slightly change your sorting function so that it used the distance property that you'd calculated.

Edit:

If you're not too invested in canvas2d, and depending on what you need to do, it may make sense to move to Babylon.GUI, which is currently better maintained.

http://www.babylonjs-playground.com/#N9MYJN#4 - the equivalent of the previous pg in Babylon.GUI

http://doc.babylonjs.com/overviews/gui

Link to comment
Share on other sites

Holy crap, Sable... NICE!  You're a God!

StarToaster - great name, welcome to the forum... good to have you with us.  Interesting challenge!

And @sable, also welcome... just in case nobody ever welcomed you.  Good to have YOU with us, too.

Are you guys lurkers?  That's some pretty fancy coding for 1-post and 20-post forumers. 

I think we got us some new BJS super-heroes... both of these guys.  Cool!  :)

(I ran out of forum LIKES - maximum 10 per day.  SO, I used this post to send you guys a 6-pack of LIKES)  :)

Link to comment
Share on other sites

12 hours ago, sable said:

http://www.babylonjs-playground.com/#N9MYJN#3

The projection was fine, just needed to not center the text (i.e. not set margin alignment to center), and translate the y coord from screen coords to canvas2d coords (canvas2d has the origin at the bottom left as opposed to the top left).

Also needed to get the closest corners I needed to slightly change your sorting function so that it used the distance property that you'd calculated.

Edit:

If you're not too invested in canvas2d, and depending on what you need to do, it may make sense to move to Babylon.GUI, which is currently better maintained.

http://www.babylonjs-playground.com/#N9MYJN#4 - the equivalent of the previous pg in Babylon.GUI

http://doc.babylonjs.com/overviews/gui

Thanks for the help! I'm actually working with my own HTML-based UI, however, I might take a look at Babylon GUI.

 

9 hours ago, Wingnut said:

Holy crap, Sable... NICE!  You're a God!

StarToaster - great name, welcome to the forum... good to have you with us.  Interesting challenge!

And @sable, also welcome... just in case nobody ever welcomed you.  Good to have YOU with us, too.

Are you guys lurkers?  That's some pretty fancy coding for 1-post and 20-post forumers. 

I think we got us some new BJS super-heroes... both of these guys.  Cool!  :)

(I ran out of forum LIKES - maximum 10 per day.  SO, I used this post to send you guys a 6-pack of LIKES)  :)

I've just started with BJS a couple of days ago so I don't know how much of a super-hero I am.. lol but thanks.

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