I have a blueprint function which I’m trying to use to position speech bubbles close to the person who speaks it. It gets the location of the speaker as a Vector3 as a function input, converts that to screen space, draws an imaginary circle around the character, and snaps the bubble to the point on that (imaginary) circle closest to the speaker’s location:
I expect this to position bubbles somewhere in a circle around the player depending on the speaker’s location, but regardless of location it always places the bubble in the bottom-right corner of the circle. Is there an obvious cludge-up with my math?
Is the players relative screen position always the same due to 3rd person perspective and camera location?
Everything is fixed apart from the output of the convert node which must therefore always be the same… the node you are using is part of the player framework so I’m thinking it won’t work for non player character?
The character that’s speaking doesn’t have to be the player; speech is initiated by a HeardSomething event that the player broadcasts, the event contains an FString with the display text, and a FVector of the speaker’s position. If I unplug steps 1-3 and connect my WorldToScreen conversion results to SetPositionInViewport, it correctly positions the bubble over whomever spoke, which is why I’m assuming my math is to blame.
Yea, what I’m trying to do with the normalize is to constrain the bubble’s position to within a certain circle around the player. I made some terrible MS Paint art to illustrate. I get the first image by moving the widget to my worldtoscreen results, but I’m trying to get the second image by drawing a vector from screen center to the starting position, then moving towards the center along that vector:
So the equation would be (((screenCenter+characterScreenLocation)->Normalize()) * fRadius) + screenCenter ? That moves it on a curve a bit, but I think something is still weird- I attached a screenshot, the cone is the object that’s talking and the radius is 100, so I expected the text to render about 100 units away from screen center on the player’s left, but it ended up on the right side.