Well. Here’s what I mean.
Y’know how when a character would follow a character but not exactly stop at the followed charcters exact position?
Hmm, well kind of like Sonic and Tails.
I’m getting a hunch that I need to use the Movetowards function but then add additional numbers around it such as
**Movetowards this object X Position plus 3 **
I’m thinking something like that. I’d appreciate it if someone gave me a hand.
Hi,
check the vector of the object you want to move and the vector of the target object. Than stop the movement when the vector from MovingObject to targetObject have a specific length.
e.g.:
direction = tails.transform.position - sonic.transform.position;
if(direction.magnitude < distance)
{
//stop moving
}
Assuming that tails follows sonic.
First you want to figure out what your stopping distance is. There’s a few ways to do this - you could put a debug.log(Vector3.distance(character1.transform.position, character2.transform.position) and position your characters in play mode until they’re at a distance you like. Or trial and error it.
Once you have that number (or again, make it up and adjust as needed) you can certainly use MoveTowards if that makes sense for you. You can then do something like
if(Vector3.Distance(character1.transform,position, character2.transform.position) > stoppingDistance)
{
//Movement stuff here
}