UnityEngine.AI.NavMeshAgent.Warp C# (CSharp) Method

Warp() public method

Warps agent to the provided position.

public Warp ( Vector3 newPosition ) : bool
newPosition Vector3 New position to warp the agent to.
return bool
        public bool Warp(Vector3 newPosition)
        {
            return INTERNAL_CALL_Warp(this, ref newPosition);
        }

Usage Example

 public virtual void respawn()
 {
     navagent.enabled = true;
     if (fac == Types.Faction.BLUE)
     {
         navagent.Warp(GameSceneConsts.blue_team_respawn_pt.transform.position);
         navagent.SetDestination(GameSceneConsts.blue_team_respawn_pt.transform.position);
         AI_unit.holdedPos  = GameSceneConsts.blue_team_respawn_pt.transform.position;           //not sure if this is necessary
         transform.position = navagent.transform.position;
     }
     else if (fac == Types.Faction.RED)
     {
         navagent.Warp(GameSceneConsts.red_team_respawn_pt.transform.position);
         navagent.SetDestination(GameSceneConsts.red_team_respawn_pt.transform.position);
         AI_unit.holdedPos  = GameSceneConsts.red_team_respawn_pt.transform.position;           //not sure if this is necessary
         transform.position = navagent.transform.position;
     }
     gameObject.transform.rotation = Quaternion.identity;
     //refill hp and mana
     change_health(runtime_u_stats.max_hp);
     runtime_u_stats.mana = runtime_u_stats.max_mana;
     navagent.Resume();
     flags.is_dead = false;
     ui.refill();
     gameObject.layer = GameSceneConsts.LAYER_DEFAULT;
 }
All Usage Examples Of UnityEngine.AI.NavMeshAgent::Warp