# 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.

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;
MoveAcrossNavMeshesStarted= false;

}


To make it look like a jump, you could

1. lerp between the two positions and play a jump animation on a child node of the hierarchy
2. calculate the y-position yourself, e.g.
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.

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()
{
{