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