How To Get My Character's Health While Possessing A Vehicle

Hi, I am currently working on adding vehicles into my game. I can possess them, and get out of them and repossess my character. The only problem is, My HUD widget displays my health based off of my character. When I possess my vehicle it can no longer call my health. How can I continue to get my health from my character while possessing my vehicle?

You’re presumably doing something like ‘getplayercharacter’ in the widget.

When you’re in the car, the character is the car, so it doesn’t work.

A better way is, in the widget, use something like getactorofclass to find your player and then extract the health. In other words, find some way of pinpointing your player actor and then read the health.

Perhaps moving health related functions into the player controller along with other damage related functions might help, assuming they are not already especially if you have the pawn or character the player is initially controlling be deleted upon entering a vehicle.

Yeah, I’m not fond of using player controllers, Though I probably should. Using that to store my values completely passed my mind. Thanks!!! I mainly just put all of the code into the character or pawn blueprint.

Also is there a way to control both the controller and the vehicle?? I need to the player to animate based off of my inputs controlling the vehicle.