Announcement

Collapse
No announcement yet.

Pawn rotating towards the player...stop it

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

    Pawn rotating towards the player...stop it

    I have created my own derived AIController and Pawn classes.

    When pawn gets hit he falls down and lies on the ground for a few seconds then gets back up. While the pawn is lying on the ground he still is rotating towards the player as the player moves around. I know my code isn't doing this. It probably is something updating its rotation in AIController or Pawn but I cannot figure out what's doing it.

    If I set the pawn's physics to PHYS_None while its lying on ground the rotation problem goes away. I guess this is a solution but I could imagine this could also cause me some problems later on down the road if I want to other things with the pawn while it's lying down.

    Is there anyway to turn off this auto rotation towards the player aside from 'turning off' it's physics?

    Thanks!

    #2
    I do recall finding a variable called bAlwaysFaceCamera or something close to that. I am not sure it this is your problem, but from the sounds of it, it could be... Sorry, but I forgot where I saw that, you might have to do some sneaking around in the code to look for it. Check the Pawn class frist.

    Comment


      #3
      Hey thanks for the reply but, bAlwaysFaceCamera is for sprite type effects.

      Comment


        #4
        You need to set bRotateToDesired to false.

        Comment


          #5
          Originally posted by Mysterial
          You need to set bRotateToDesired to false.
          Thank you!

          Comment


            #6
            Originally posted by Mysterial
            You need to set bRotateToDesired to false.
            I was able to add the code this morning and neither setting bRotateToDesired = false for myPawn nor myAIController kept the pawn from rotating on screen.

            Comment


              #7
              Are you not doing anything to disable the AIController? Probably the easiest way to disable it would be to simply set its bStasis property to true (prevents the Controller from getting ticked)

              Otherwise the AI will keep trying to move toward the enemy, so it will keep resetting bRotateToDesired and other associated properties.

              Comment


                #8
                Ah ok thanks for the info. I am using the MoveToward() type functions (defined in Controller) but obviously not when my pawn is lying on the ground.

                So set bStasis=false when the pawn is lying on the ground? But reset it to true when the pawn is up on it's feet and running around?

                Comment


                  #9
                  No, the other way around. You don't want the AI to get ticked when it is on the ground, so bStasis should be true then.

                  Comment


                    #10
                    Originally posted by Mysterial
                    No, the other way around. You don't want the AI to get ticked when it is on the ground, so bStasis should be true then.
                    Again thank you for taking time to reply and for the tip!

                    Comment


                      #11
                      I figured out another way to get enemy pawns not to face you without having to set the bStatus to true.

                      This code is in my Stunned state in my own AIController code:

                      Code:
                      Enemy = None;
                      FocalPoint = Pawn.Location + 512*Vector(Pawn.Rotation);
                      Focus = None;
                      Then reassign the enemy reference to you desired target when you want the AIController to start looking at you (the player pawn) again.

                      Comment

                      Working...
                      X