So currently I have a Player Char and NPC, and I want the NPC to look at the player when they walk around near by, pretty simple stuff. But as it goes now I am doing a bunch of stuff on the tick events of the Characters and so I am looking for a better methodology.
My current set up is something like this.
The character-BP will get essential information on the positions, and send the positions vectors to the ABP, the ABP then sends that information into the Control Rig, and the rig will update Aim on the Neck / Head in the control rig to look at the character.
This works, but it makes a ton of hard references to classes, and it seems to be really slow an use a lot of resources off the tick event– even if filtered by some delays (also not ideal).
—
The next thing I tried was to only update the Player Character position when the player character is moving via event dispatchers on my inputs in the player-char… That is definitely more performant, but it doesn’t update the NPC character if there is an anim montage playing on the NPC. And only updates when the Player Chars is moving, so if the player is still, and watching a NPC character dance the NPC’s head wont track the Player character, and so you would need to update the NPC control Rig for the self movement of the montage anims in the NPC– and pretty much gets you right back to every tick or close to it.
–
So the simple question is how do I track the movement of the player and update the information to the NPCs in the most efficient way?
I was thinking that maybe I can have a small manager class that just handles the player characters position data and relays it to any one that needs via event dispatchers, but i am not even sure if that would be sufficient because of the self animation issue on the NPC… Anyway I am curious as to how other have dealt with this issue in the most performant way.
Obviously I can gate the entire function via distance, and I do, but even if with distance gating it is taking up a decent amount of resources… is this just more of compute cost than I was expecting? Is there away to make this more efficient and I am just not seeing it?
Any help is greatly admired.