Entity occasionally snapping/teleporting to origin when moved by non-A* script

Hi,

I have a situation where user input can apply movement directly to entities which have a movement script on them (though doing so should cancel any active pathfinding). I’m seeing unusual behaviour in my test scene.

I have a recast graph and RVO simulator in the scene, and 4 entities with Follower Entity on them (though the behaviour seems to still occur with RichAI), each with Local Avoidance turned on. Navmesh clamp is present on each entity so user input can’t push them outside of the graph.

When all entities are stationary and I begin moving one directly with keyboard input (transform.position += …) occasionally outside of the Update() function the X and Z of the transform.position are reset to 0. This happens unreliably but frequently to the entity I’m moving directly, and to any other entities pushed around by it.

This gif shows the issue better than I’ve described it: Example Gif

Interestingly, if there is a break in the graph, such as a wall, between the entity and the origin when this happens it gets stuck on that break when ‘teleporting’.

It’s unclear to me from reading the manual player movement documentation if this is a bug, or what I’m trying to do is unsupported behaviour. I haven’t used the first case shown here as I want user input to move the entity forwards and backwards without requiring rotation.

To clarify, this behaviour is seen on 5.0.8 and 5.1.1

Any input is very appreciated. Happy to provide a demo scene with the issue if it’d help.

Hi

You should not have a movement script if you are also applying movement directions directly to the transform.

The agent will get very confused.
If you really want to do this, then set ai.position instead of transform.position.

Not quite sure why this happens, though. It’s a very long teleport…

Thanks for the input.

Experimenting with setting ai.position, the agent still has the same behaviour, as do any other agents that get pushed by it.
As what I’m doing is not supposed to be supported, that’s fine. I’ll look into a different solution for my situation.
From shear intuition, do you think it’s worth trying messing with disabling the movement scripts when I have user input, or am I better off looking into writing my own movement script which supports this?

Cheers!

Hi

I haven’t been able to replicate this. If you have a demo scene that would be most appreciated.
Make sure you are using the latest version of the package.