Announcement

Collapse
No announcement yet.

Flying object controlled by AIController stops when over target

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

    Flying object controlled by AIController stops when over target

    So I have an object that's being moved by an AIController. I use MoveToLocation to give it the target. It moves there, but stops when the x and y coordinates are in the right place.

    But since it's a flying object, it may be above or below the target, but it stops moving anyway. Is there some way to tell it I want it to keep going toward the target even if the x/y are already right?

    #2
    I'm going to try looking in the source, but I can't find the right file. I'm now using the AIMoveTo node in the blueprint, but all I can find is K2Node_AIMoveTo.h and .cpp. There's no movement code in here, just some BP interface stuff.

    Comment


      #3
      Are you sure you are setting the full vector for it including the Z axis? This should work on the z axis still since the AI can go up stairs to multi level buildings etc. Possibly your movetolocation success radius is large enough that it's colliding with it already?

      Comment


        #4
        The move location radius is 1, and the z target is 1000 below where the object is. The thing works fine as long as the x/y aren't close enough, so it would go up stairs. What it won't do is go vertically. Here's the part of the script. It gets the Z component of the level's height map from the GraphicsBufferQueryComponent, adds 5000, then sets that as the zcomponent on the bird's currentlocation, then sets that as the target location in the blackboard. The values all look right while it's running.

        Click image for larger version

Name:	Untitled.png
Views:	1
Size:	180.5 KB
ID:	1090967

        Comment


          #5
          I was meaning up stairs to the second level of a house. Eg. Your AI is on level 1 of a house at location 300,300,0. But you want him to move upstairs to location 300,300,300. Can you show your behaviour tree and what the acceptance radius is on the moveto node?

          Comment


            #6
            I dug into the movement code. When making calling Simple Move To, the path finder generates a 1-node path on the navmesh, which is invalid. Paths must have at least two nodes for the underlying C++ code to consider them valid. If I take the above BP and add 1 to the X coord of the destination, it works fine.

            Comment


              #7
              Interesting fix. Not sure if thats a bug or not, perhaps report it or post on the answerhub?

              Comment

              Working...
              X