mkadirtan 0 Report post Posted November 24, 2018 Hey everyone! In my project I need to create a Button3D and then rotate it around. However, there is no rotation property or rotate method for Button3D and some other GUI3D elements, too. I didn't provide pg for this but I think my point is clear. If this is the way it needs to be, I should better use MeshButton3D or ActionManager on a mesh I think? Much thanks in advance! Quote Share this post Link to post Share on other sites
ssaket 51 Report post Posted November 24, 2018 Hi, You can use TransformNode to achieve this, posting one of my previous threads - Quote Share this post Link to post Share on other sites
brianzinn 373 Report post Posted November 24, 2018 4 hours ago, mkadirtan said: However, there is no rotation property or rotate method for Button3D and some other GUI3D elements, too. You may not be interested in the implementation details, but I'm going to show you why they don't have a rotation property and how to get around that. That's because the 3D controls only have position, which delegates to the 'node' member variable: https://github.com/BabylonJS/Babylon.js/blob/master/gui/src/3D/controls/control3D.ts#L32 You can use linkToTransformNode() as ssaket explains. Here is the code for linking, as you can see it just adds a parent (which is best for positioning multiple controls in 3D together): https://github.com/BabylonJS/Babylon.js/blob/master/gui/src/3D/controls/control3D.ts#L239 You can directly rotate 3D controls by accessing their 'node' property!! 'node' is only available after they are added to manager. Here I am rotating the button 45 degrees. https://www.babylonjs-playground.com/#2YZFA0#11 Quote Share this post Link to post Share on other sites
mkadirtan 0 Report post Posted November 24, 2018 Ahh, thanks a lot! I've tried linking to a node but didn't see anything happening because I was adding my button to manager in a later point. Have a nice day! Quote Share this post Link to post Share on other sites