Trouble with positioning GUI and Centering Text

I have gone through the docs a bit and I am having trouble positioning the GUI element to a vector point. I understand how to position it when I link it to a mesh but not vector. In the playground I have an attempt with “movetoVector3”. If someone can point out what I am missing I would appreciate that.

Also in the GUI when I place an x with a circle-styled gui, the letter isn’t centered. Is there a way to correct this other than using an image with a correctly centered x?

Heya :slight_smile: Here’s a few things that I changed to get it working:

  1. Wait until after the control is added to the adt
  2. Call scene.updateTransformMatrix() first (needed because the scene hasn’t been rendered yet)
  3. Pass the required scene parameter
1 Like

CC @carolhmj for help with the text not being vertically centered. :slight_smile: Making the font smaller or the button larger seems to fix the issue but IDK why it’s not working with the sizes used in the PG…

So for the positioning, it resolves the problem of moveToVector3 not working but how do I position it as a specific vector in the scene? As if I am positioning an object.

It seems to be working that way already as far as I can tell. EG. here’s the sphere at the same position as the button… If it’s not working for you can you update the PG and/or explain more what you’re after?

When you move the camera, the gui is stuck to the screen and not in the scene

so like in this PG it is set to a position no matter the movement of the mouse in relation to the camera.

So moveToVector3 just computes the screen position one time, it’s not automagically recomputed when the camera transform changes… But you could try calling it again manually whenever the camera transform changes like below for example.

Alternatively maybe CreateForMesh could help if you want the GUI to be part of the 3D scene. :slight_smile:

That first method made my fans go on overdrive and when I added it to my scene the text trailed in the GUI. I am going with the linktomesh method in this playground.

Sounds good, I would prob just use linktomesh (or CreateForMesh) too rather than trying to refine that other approach (calling moveToVector3 repeatedly)… :slight_smile: :beers: