Blueprint for HUD display of player location using Z-axis

Hello,

I’m trying to create a HUD widget to display the player’s height using the Z-axis.

I’ve tried using Self - Get Actor Location with a break vector outputting the Z to a PlayerHeight float. I then tried using Get World Location instead from various targets (capsule, FP camera).

I’m now trying Get Distance To with Self and Get Actor of Class (with a new Actor set as the Other Actor); also outputting to a PlayerHeight float.

Using Print string to see if any of this was working but Print string isn’t showing up.

I’m far from a programmer I’m afraid so any advice is appreciated, thanks.

Can you show the actual node that leads to your print string?

If you want the player hight then GetActorLocation → Break Vector and teaking the Z component should do the trick.
The node self will return the blueprint you’re in, so if you are anywhere else than inside your character class, then you should use GetPlayerCharacter to get a reference of your Character.

Thank you,

Yes that’s correct I’m inside the player’s FirstPersonCamera blueprint when using the Self node.

I’ve just added Event BeginPlay to Print String and now it outputs my PlayerHeight float as “0,0” (the default value) and only displays this once in the log.

If you’re not inside your character blueprint then Self will not return your player.
You should have something like this and call it whenever you want the variable to update, maybe on Tick

1 Like

Thank you, this has worked

My next task is to try and replicate this in connection to the HUD display widget!
I’ll try to update this thread if I figure it out, otherwise if anyone has advice it would be greatly appreciated.

1 Like