need your help! I am working with SteamVr/Vive, and currently have an AI that does a Simple Move to Player Pawn when spawned, and once it is close enough, it begins its attack list. The problem I am having is that the ‘Player Pawn’ doesn’t seem to stay with the Headset/HMD… so the AI just attacks the pawn object where it was placed at level start, which means you can walk around the AI and he is still attacking that pawn spawn location/not following the HMD as it moves around. I also setup a Rotator on an event tick for the AI, so that it always faces the player pawn, and have verified that, THAT works…but again the pawn/HMD seem to not be attached to each other.
Am I missing something? I have the Player camera ‘locked’ to the HMD, so that part is setup correctly.
You need the camera location/actual HMD position instead of pawn location. You would also want a collision object attached to the camera that can interact with the AI.
How did you make the location of the camera/headset public. At current my ai tracks the default vr pawn asset which results in it always looking for the center of the “scene” which in this case is “VROrigin”. I was also thinking that tracking the headset would be better, but the ai is searching for a pawn.
For working with EQS or AI, sometimes it is easier to make dummy blueprint actor, and tell AI to follow it instead of real goal. Then that actor can snap to real actor location (usually update on tick and just copy transform over and apply to self). This way i can have single EQS for bots, instead of branching and following different targets.
So to follow VR camera I made BP_marker that reads VR camera location and snaps to it:
make BP_Marker, that is just empty blueprint
in it on event tick find player pawn, cast to your player pawn class
get camera reference, get its world transform
save that in variable inside BP_Marker
set transform for SELF to stored value (inside BP_Marker)
Thank you for this info, I have been busting my head for a while before stumbling on this thread. Can you please share your method if it differs from the others? Thank you!
what do you mean - set transform for SELF to stored value (inside BP_Marker)? I am making a VR game and needed to have the AI shoot at me right now the AI shoots off to the left of my VR pawn,