• Godot Help
  • How to make an arrow point to and from two separate GUI elements.

I have a Player class and an Enemy class.

The Enemy class is pretty much identical to the Player class.

I also have a "Speed Dice Container" class.

I just followed the "2D GUI in 3D Space" tutorial.

This GUI is placed above every player/enemy.

Keep in mind, every "2D Object" in this 3D environment has "billboard mode" on. Regardless of camera orientation, the objects will face directly towards the camera.

I want is to be able to create an curved arrow point from the player's GUI element to the enemy's GUI element.
I don't know where to start considering the GUI are separate objects.

I want to be able to have them point from either character, as well as have arrows come from both of them and meet in the middle.

How should I go about this?

It's doable but would be much easier if Speed Dice Container was just a plain 2d overlay. Can you post an actual screenshot?

    poombus Is there a reason you're using viewports instead of plain 2d gui?

      It looks to me like you'd need to draw a 2D line and have it follow a parabolic arc to your target, attach a 2D arrow sprite to whatever is drawing the line and that should give the effect you're looking for.

        xyz
        I could do that if I could get the coordinates of the characters on the screen, rather than in the 3D space of the level.

        I was using viewports because I figured that it would follow the parent wherever it went and I didn't really have to think about it.

          Lethn

          Okay! That solves the question of having a nice-looking arrow.

          Now the only problem left is drawing the arrow in the right position. As I said in the comment before this, it would be simple if I could get the coordinates of certain Objects relative to the screen, rather than the 3D world, but I don't know how to do that.

          poombus I could do that if I could get the coordinates of the characters on the screen, rather than in the 3D space of the level.

          Use Camera3D::unproject_position()

            stranger_anger

            xyz

            This might actually probably, without a doubt, be the solution. I'll get back to you once I implement it.

            Ok, I have a object, that when given two points, will draw an arc between the two points. So, TECHNICALLY, I have my question answered.