DylanD Posted August 6, 2018 Share Posted August 6, 2018 Hi there everyone, I am trying to make a new circle button module(in BABYLON.GUI), it would work exactly like a regular button but in the shape of a circle. I have a prototype here which makes the button look like a circle but I can still click outside the circle to activate the button. I was wondering how can I change that so you can only activate the button by clicking inside the circle. I don't fully understand why this doesn't work since I took out the rectangle portion of the button. Any ideas? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 6, 2018 Share Posted August 6, 2018 Really approximate but you get the idea: https://www.babylonjs-playground.com/#EJX0YB#1 (from #40 to #44) Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 6, 2018 Author Share Posted August 6, 2018 5 minutes ago, Deltakosh said: Really approximate but you get the idea: https://www.babylonjs-playground.com/#EJX0YB#1 (from #40 to #44) wow this is great! I don't really understand it very well, but this is great. So how I think it works is centre get the square that used to be the pick area, then I'm lost. I think current is the mouse pointer coordinates... Thanks though DK! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted August 6, 2018 Share Posted August 6, 2018 It computes if the mouse pointer is inside your circle by computing the distance to the center and comparing it to the radius Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 6, 2018 Author Share Posted August 6, 2018 Oh I see that now, thanks for the explanation it helped a lot. Thanks Again! 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.