StarToaster Posted June 20, 2017 Share Posted June 20, 2017 Hi, Here's an example of what I am trying to do: http://www.babylonjs-playground.com/#N9MYJN#2 I should see my four corners appear around the sphere on the 2D canvas, but for whatever reason they do not show up in the correct spot. Thanks, -StarToaster Quote Link to comment Share on other sites More sharing options...
sable Posted June 20, 2017 Share Posted June 20, 2017 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 StarToaster and jerome 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 21, 2017 Share Posted June 21, 2017 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) Quote Link to comment Share on other sites More sharing options...
StarToaster Posted June 21, 2017 Author Share Posted June 21, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.