Creating a gui node in the same visual position as a game object


#1

I’m use orthographic camera to do this:

  1. Use camera.world_to_screen(camera_id, world)to get the screen position
  2. Send the position to a gui that clones a node, set_parent to a node in position 0,0 and then sets the position.

This works great if the window hasn’t been resized. If it’s resized the cloned nodes end up in the wrong place. Any idea why?


#2

Sounds like the stored width and height are not updated on window resize.

Never used orthographics but maybe try to run orthographics.render.helper.update() when you get the window_resized message. Might also have to do orthographics.render.helper.set_screen_view_projection() and orthographics.render.helper.set_world_view_projection().


#3

What if you disable the adjust mode (select root of gui and in properties change Adjust Mode from Per Node to Disabled)?


#4

Same result I’m afraid. @Jerakin’s suggestion is a bit more long winded, do you think it would do the trick @britzl?


#5

I forgot to say, but this is already done if you are using orthographic.render from the project.
If you haven’t already under bootstrap change Render to /orthographic/render/orthographic.render
15


#6

Yep, already done.
01

I’m using the camera for many other things like culling and it’s been great. This is the first stumbling block!


#7

Can you create a ticket in the repo and I’ll take a look as soon as I can?


#8

Done, thank you!