# Unity how to set Off mesh link speed

How can I set agent's speed on off mesh link? I want it to look like a jump, but now it looks like it was in slow motion.

You can have an Update or FixedUpdate function check when the agent is on an off-mesh link, and modify its speed in response, as shown here:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

{

public NavMeshAgent agent;
public float origSpeed;

void Start()
{
origSpeed = agent.speed;
}

void FixedUpdate()
{
{
}
else if (agent.isOnNavMesh && linking == true)
{
agent.velocity = Vector3.zero;
agent.speed = origSpeed;
}
}
}


This seems to work with my NavMeshAgent settings.

This unity forum post suggests handling the traversing yourself.

if(agent.isOnOffMeshLink && !MoveAcrossNavMeshesStarted){
MoveAcrossNavMeshesStarted=true;
}

{
agent.updateRotation = false;

Vector3 startPos = agent.transform.position;
Vector3 endPos = data.endPos + Vector3.up * agent.baseOffset;
float duration = (endPos-startPos).magnitude/agent.Velocity.magnitude;
float t = 0.0f;
float tStep = 1.0f/duration;
while(t<1.0f){
transform.position = Vector3.Lerp(startPos,endPos,t);
agent.destination = transform.position;
t+=tStep*Time.deltaTime;
yield return null;
}
transform.position = endPos;
agent.updateRotation = true;

s = 0,5 · a · t2 + vo · t + s0
with vo being the initial velocity and s0 being the inital position. Use this formula for y.