I’m currently trying to get enemies in my project to look at the player’s head bone instead of the default location used by the Sight Perception System so the player can crouch behind cover to hide, and the enemy will see the player over cover while the player is not crouched.
I found a couple guides online and have managed to get the target location working correctly, the enemy does look for the head socket now. But now the LineTraceSingleByChannel is not blocked by any of the level geometry any more. I’m really not sure what’s up, all the geometry it is ignoring is set to block the visibility channel, I have triple checked. It is still detecting a hit on the player I believe as the sight perception debug sphere is getting updated as I move around and is registering as a sighting.
Dang thanks! I changed the _API as mentioned and threw this in the source folder but when I tried to compile I got all kinds of errors. I’m using 4.27 not sure if that’s the problem it looks like you built this in 5. I also just kinda have no idea what I’m doing with C++ in general
Trace detection is working. So if you go behind a wall it will save the last seen location.
Sight is set in the sight config of the perception component just like in 5.3
You could probably also make the “head” in the cpp file an exposed FString UPROPERTY and expose it to the config if you want the enemy ai to look at different bones of the character. But this would probably require a custom sense config with exposed variables.
The first time I tried packaging, it was actually successful but the perception wasn’t working and it crashed when I tried turning on the debug. Now I’m getting the above error when I try packaging or launching standalone. So confused. I haven’t altered the .h or .ccp file aside from the _API change required.
From googling the error it looks like something required might not be being included?
Seems it needed 1 more function (CalcQueryImportance) to pack. Even though it was a protected function in the parent class. Added it in and it packed correctly.