Smooth off-mesh links traversal

  • A* version: 5.3.3 pro
  • Unity version: 6000.0.34f1
  • FollowerEntity, Grid Graphs, Off-mesh Links

I’m working on a Theme Hospital like game. So I have grid graphs stitched together with many off-mesh links. Everything works fine, except characters slow down and rotate before each off-mesh traversal. I’d rather prefer them to move without disruptions, even if it means they’ll be inaccurate during the transition.

Is there a way to smooth it, or to limit their accuracy?

Kind regards

Are you using custom off-mesh links? If so could you post that code?
Also your agent settings :+1:

No, regular. I didn’t know customs could be made, how can I do that? Is there a tutor?

As for the agent settings, I really don’t want to change those, as I need their motion and rotation to be precise when it comes to interactions.

Yeah you can totally script your own, as explained here. The system gives you a lot of control on handling off-mesh traversal behavior, so you could make them not slow down and rotate, AFAIK. Or any number of things really :+1:

Thanks! I’ll give it a try. Not sure though that this is the solution. The question is “Are the slowdown and rotation - parts of the traversal or are they parts of FollowerEntity motion?”

My first thought was that they’re part of the off-mesh link. If you’re using solutions that ship with Astar, I think it’s entirely dependent on which ones used- like in the documentation, the “jump off” and “teleporter” ones don’t stop but the opening doors one does. Show me your setup/off-mesh links your using and I can check on my end if it’s supposed to be smooth or not.

Tested. The agent slows down before the teleport.

IEnumerable IOffMeshLinkStateMachine.OnTraverseOffMeshLink(AgentOffMeshLinkTraversalContext ctx)
	{
		var end = (Vector3)ctx.link.relativeEnd;
		ctx.Teleport(end);
		yield return null;
	}

So it’s the motion. One possible solution is to change agent settings dynamically when the motion targets a different grid or a link. Is there a way to know if an agent is targeting a link?

Or maybe is there a way to trigger a link when an agent is in range?

Also, a big thank you for helping :pray:

Yeah there’s some options that you can work with. Quote from Aron on a previous topic:

Hmm… I tried to find some way to “force using this off-mesh link” but I didn’t find anything like that. However I did find that in your custom off mesh link handler you can use this to force using the existing movement settings. That class (AgentOffMeshLinkTraversalContext) has a lot of useful information for crafting the movement you might want actually. Give it a look? :smiley:

Of course! :DD

That should be more than enough. Thank you again!

1 Like

No problem! :smiley: