Object 'teleporting' when moved while on path

So I have an object with DestinationSetter, Seeker and RichAI and I’m using a recast graph. I make the object move sometimes towards another object’s transform using the DestinationSeeker. However the player has the option of ‘lifting’ the object, thus interrupting its movement towards the path. It goes well while the object is being carried but once I set it down, it does this weird behavior where it teleports a short distance from where I set it down and starts going towards the destination transform again. It stops doing that teleport thing when I set the ‘canmove’ to off but once I turn it back on, it does that teleporting thing again even if it’s already set down.

If I can stop that behavior it would be great, or to even just completely stop the object from going to its target destination transform on command. (it shows that green line going towards the destination object. I’ve even tried destroying the destination object but the AI object keeps moving.) I’ve tried several approaches (isStopped, seeker.cancelcurrentpath etc) but none of them seem to work. Please help?


the moment the player set’s down the RichAI object call the Teleport function on the RichAI component.
This will make sure it has the right position set on it’s internal movement system.

I’m a total noob so how do I do that? Let’s say it’s:


How do I use teleport so that the green line disappears and it stops going to its path?

Ye something like that.

When you pick up the object set canMove to false.

When the player puts It down again do something like this.

RichAi movingObjectAi = ObjectBeingCarried.Getcomponent();

MovingObjectAi. Teleport( putDownPosition);
MovingObjectAi. CanMove =true;

Sorry for bad formatting, I’m on my phone :slight_smile:

But how do I remove that green line? Or make it recognize its old path as canceled or complete? I’m also noticing some weird behavior in another object where it tries to keep going to a previous destination (traceable through the green line) even though i set a new destination using the DestinationSetter script

I don’t fully understand what you want the object to do after picking up.

Object moves around the scene towards a Target Object. Player can pickup the movingObject and place it anywhere in the world. Is the movingObject still supposed to move after it has been picked up? Or should it satay where the player placed it?

It should just stay where it is when I set it down. Usually it does this perfectly as long as I haven’t set a destination for it yet using the DestinationSetter. Once it has targeted a transform, and I pick it up and set it down, it exhibits some weird behavior. It basically teleports a short distance (I’m guessing towards the nearest node). I think if I can ‘reset’ it to a state like how it was before DestinationSetter had a target, it’s going to work perfectly. As it is now it still has a green line towards where I last picked it up from.

I do think the destinationSetter sets the destination everyframe or so, you probably want to disable the destination being set once picked up.
Or you could just disable the RichAi component.

I think I found out what the issue is, basically I was carrying it into a non-traversable area for the recast graph and so the pathfinding is teleporting it to the nearest traversable area. Thank you for the help though it narrowed my troubleshooting!