I looked around and could not find someone who has done this so I figured I’d ask here.
Does anyone know how to make objects trail another object? And that’s trail, not follow or move towards. I mean follow the object’s exact path, not just head straight for the object.
I’ve seen this done by keeping an exact distance, stopping when the object stops, or by time and simply have a delay.
I imagine you can make a list of set positions then have the trailing object move to them, but that seems excessive. Surely there’s got to be a better way, right?
If you use the A* Pathfinding Project, you can literally just pass behind the grid coordinates to another object every time the next point is reached. If you queue up the coordinates passed back instead of only having one “goal” reference at a time, and you use the same movement algorithm, you’d be able to follow the exact path even when ObjectB is moving a little faster or slower than ObjectA.
I imagine that doing this even without A*PP this would be pretty trivial- just set a coroutine on ObjectB to grab and queue up positional data from ObjectA every 10th of a second, or whenever, and use those as micro-checkpoints. It likely wouldn’t take longer than a few minutes to get functioning, provided ObjectB already has a “toPoint” style movement controller.