Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Rigidbody.interpolation don't work with NavMeshAgent in 2022.3.16f1

Discussion in 'Navigation' started by Lekret, Jan 24, 2024.

  1. Lekret


    Sep 10, 2020
    Hi, I migrated from 2021.3.9f1 to 2022.3.16f1 and my NavMeshAgents began to move too slowly and jittery, even though their velocity was correct during debug.
    As I found, it was caused by Rigidbody interpolation being enabled. It seems that in newer versions interpolation works even when Rigidbody doesn't actually move.
    I obviously disabled the interpolation, but now the Player can't properly push other characters around anymore, i.e. they are pushed, but they jitter for obvious reason, because Player has interpolation enabled and it should be.
    Before migrating everything worked even with enabled interpolation and such hybrid approach with NavMeshAgent+Interpolated Rigidbody worked perfectly, and now it seems that I can't use it anymore. Seems like a harsh breaking change for me. Are there any good alternatives or workarounds to recreate such behaviour in newer version?
  2. Gabo_campitelli


    Oct 17, 2012
    have you updated AI Navigation package?
    anyway, I don't think Navmesh agent can move a rigidbody since it uses transform. for 2022 you need to move rigidbody with rigidbody.MovePosition
    unless that rigidbody is kinematic.
    The player isn't pushing objects because it has no velocity. you are just moving the transform.
    To make it hibrid, you have to use a separate navmesh agent and have your character move towards the nav agent. you can check how far the agent has moved before updating it so it doesn't move too far from the player.