• Strange AI navigation glitch?
    0 replies, posted
Hello all, I'd just like to ask if anybody has any idea why the following happens: I've programmed my SNPC to chase after player.GetByID(1) (me in singleplayer), and every time it resets it's movement, it attempts to move to the player's new position after it's moved, but there are two cases: No.1 ~ The player is noclipping, the SNPC will change it's movement goal without any issue, and it will smoothly change it's run path. No.2 ~ The player is walking, the SNPC will keep doing strange rotations in an attempt to keep changing it's movement path, and will only proceed in one path if the player stops walking. Here's a video of the bug: [video]https://youtu.be/rTRc1pdCOpA[/video] I'm not really looking for a definite fix, rather an insight on to what is actually going on when this happens; here is some code: [CODE]local schdMoveToPosition = ai_sched_ori.New("ENT_CHASE") schdMoveToPosition:EngTask("TASK_GET_PATH_TO_LASTPOSITION",0) schdMoveToPosition:EngTask("TASK_RUN_PATH",0) function ENT:MoveToPosition_GRND(hPos) self:OnMoveGround() local b = false local vc if isvector(self:GetLastPosition()) then vc = self:GetLastPosition() b = true end self:SetLastPosition(hPos) self:StartSchedule(schdMoveToPosition) if b == true then self:SetLastPosition(vc) end end[/CODE] And it does this every SelectSchedule.
Sorry, you need to Log In to post a reply to this thread.