Hello, I’m using the pawn sensing component for an enemy I’m making that follows the player. It works perfectly, but now I want the enemy to be able to see the player from the back and front (As if it had eyes in the back), like I show in the picture attached. The green cone is the current sight radio, and the orange cone is the additional sight radio I want to add. I can’t seem to find a way to point a new sight radio in that direction, is there a workaround or something?
I really appreciate your help.
HMMM well i know its possible to add more than one pawn sensing component. surely that would be pointless if you could not rotate them in different directions? sorry i do not have a more useful comment. im going to try and achieve this and let you know how i get on …
Yeah that was exactly what I tried to do, but I could only place the second pawn senging in a total vertical position I’m starting to considerate to look in the source code or something like that
yes sadly i was unable to produce what you need that does not mean it cannot be done however as i am quite new myself
Well, finally I’ve made it. I had to download the source code and modified the PawnSensingComponent.cpp, especifically the GetSensorRotation method this way (the bold text is what I added):
FRotator UPawnSensingComponent::GetSensorRotation() const
const AActor* SensorActor = GetSensorActor();
if (SensorActor != NULL)
**if (bCanSeeBack == false)**
SensorRotation = SensorActor->GetActorRotation();
SensorRotation = SensorActor->GetActorRotation() * -1;**
Here’s a picture:
However, this workaround only works in a 2D sidescroller enviroment, if the enemy were to move in the XY plane, it wouldn’t work properly.
If you still have issues with this, you can also just rotate the enemy to the direction of the player each Tick so it does not need 2 sensing areas. Like this: https://confighub.photos/images/uUpSrJDMNadKIcbnc58cjjZwb.png