Pawn sensing on actor for a turret


I am trying to create a Sentry turret.
I followed this tutorial that is well done:

The problem is that with a Turret created as a character, it falls to the ground when I want to put it on a wall.
I try to disable physic/gravity but it didn’t worked.

I tried to find solutions on the forum, and found that that for object (like turrets) it is more wise to use actors or pawns.

The problem is that when I use such classes, the component Pawn Sensing doesn’t work even thought the tooltip says that it allows “actor” to see.

To resume, the behavior I want for the turret is that it watches the area and when it sees the player, it start shooting.

nik0jima, The thing about pawns used for AI is that they must have a default controller assigned to them otherwise when they spawn they just sit there and do nothing. Check the auto Possess AI setting in your pawns blueprint details - It should be set to “Placed in world or spawned” . The setting below this is the AI controller class.

Thanks for your answer but I don’t understand what to do with it.
Should I use a Pawn or an Actor or can I stay with a character ?

What do I do inside the AI controller and I can I relate my turret with it ?

There is quite a lot to learn about character AI but you can set a pawn up to be a turret very simply. Create a blueprint project with 3rd person and starter content.

  1. create a pawn
  2. Edit the pawn - give it a static mesh body - anything will do just so you can see it in the viewport.
  3. Edit the pawn - add component called PawnSensing. Now with PawnSensing highlighted you should see green, blue and yellow lines in the viewport . In the details panel you can change the 'peripheral vision angle to 45 and see the green lines change.
  4. Click on the Event ‘on see pawn’ and in the pawn Event graph add a print statement to alert you when it has been triggered.
  5. Add the pawn you have created to the scene and play.
  6. Run in front of the pawn and you should see your print message appear.

Now with that working you can expand it.

  1. Change the mesh of your pawn to look like a gun.
  2. Use the Pawn output of the ‘on see pawn’ event (this will be your character). You can get the characters position, And you can get your pawngun position and make your pawngun turn to face the character and, if you are clever you can shoot the bugger.
    Hope this is some help.
    p.s. they say an actor should work also instead of a pawn but not for me. Besides, the actor version of PawnSensing officially does nothing on a client when networking so I would not use it anyway.

FInally I started, to script a Pawn from scratch and it worked.
Thanks again.

Now that it is working, I find out that I can’t seem to use the Rinterp function like it must.
When I do that, the turrer keeps poping to the player location no matter the parameter I set.