Announcement

Collapse
No announcement yet.

Help: How to detect when pawn sensing is not active.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help: How to detect when pawn sensing is not active.

    Hi All

    I would like to know if it is possible to trigger an event if pawn sensing is not active?

    Narg
    http://www.seven-mountains.eu/


    #2
    This should get you started https://answers.unrealengine.com/que...ing-false.html
    http://celestialarch.com
    Free UE4 things available. More coming

    Comment


      #3
      Click image for larger version

Name:	27193-insight.jpg
Views:	1
Size:	108.9 KB
ID:	1066840


      Create a bool on your enemy blueprint. I called mine SawPlayer
      Event Tick -> Branch and check if the bool is true.
      The delay is set to 0.5 because that is the value of the pawnsensing component. Meaning it will only check every half a second.

      Then it gets the distance to the player. Get player Pawn is you... the player.
      On the left you see components, one of them should be the pawn sensing component. This component has a sight radius.

      Basically what you do is compare the distance with the Sight Radius of the Pawn sensing component.
      Meaning if the distance is more than the Sight Radius it means the player is no longer seen.

      This is a crude form of doing it and is mostly applicable to Platformers. The rest you can ignore as that was something i implemented for my needs.

      The important concept to understand is that you need to compare the distance from your enemy to your player, with the enemies pawn sensing radius.
      http://celestialarch.com
      Free UE4 things available. More coming

      Comment


        #4
        Hi Mate

        So other then range, there is no way to do it.

        So if I run and hide behind the wall, even though I know it is not sensing me, I can not pull that value?

        That is a bit of a shame.

        Thanks anyhow

        Narg
        http://www.seven-mountains.eu/

        Comment


          #5
          No.

          The above example is a crude platformer style pawn sensing.
          If you want to do something where line of sight is broken, what you can do is cast rays and check if it hits the player.
          I saw some cool tutorials on youtube though im not sure if he had a broken line of sight.

          Your imagination is your limit. Sort of
          For example lets say you do a line of sight, and its broken you can get that location where it last saw the player, and make the ai move to that location to investigate etc.

          Also... go search answerhub. Some people did what you are trying to do
          https://answers.unrealengine.com/que...lueprints.html
          https://www.youtube.com/watch?v=UrSxEtOOHy8

          I havent done line of sight broken by walls etc... but i think casting a single line would be the best approach.
          http://celestialarch.com
          Free UE4 things available. More coming

          Comment


            #6
            Cheers

            Worked out a simple way. Since I am scanning every .1, I put a delay of 2.5 second, and set a Bool to say I can not see pawn.

            It it is still in range then .1 later it is rest back. Seems to do job.

            Just a timeline issue now arising.

            Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	57.7 KB
ID:	1066911

            Narg.
            http://www.seven-mountains.eu/

            Comment


              #7
              i cant see "OnSeePawn" event

              Comment


                #8
                Originally posted by danUnreal View Post
                i cant see "OnSeePawn" event
                You need to add Pawn Sensing Component.

                Comment

                Working...
                X