How do I make my Player move?

Hello,
I have 2.5D game in a 3D project and after completing a goal the player is supposed to move (automatically) to a certain position, which would be -84.88f, -0.7f, -7.24f.
I’ve tried many tutorials online however none of them work with my game.
If I try the most commonly used childTransform.localPosition = Vector3.MoveTowards(childTransform.localPosition, nextPos,speed * Time.deltaTime); with empty objects then my character flies away.
I also tried using NavMesh agents, but those did not work either. My character just does nothing (let it be said, just in case that I am 100% positive that my empty object aka the position where the character should end up is at the correct place. However, it just flies away or sometimes does other weird things.

The only solution that has worked was this one:
playerTransform.transform.position = new Vector3(-84.88f, -0.7f, -7.24f);
However, then my player just transforms to this place, without moving there. Is there anyone that could help me with this issue?
Thank you!
I’ll add more details if necessary.

The method you’re using doesn’t care about local positioning.
If objA and childA are both at (0,100,0). ChildA local position = 0;
if you say move towards and use the local position the it will read as childA.MoveTowards(0, -100, speed);
Eventually the child will end up at -200 in world space.
Use transform.position instead

childTransform.position = Vector3.MoveTowards (childTransform.position, nextPos, speed * Time.deltaTime); 

Always use World Space when dealing with multiple objects. (ie. transform.position not transform.localPosition)

here is how i do it:

public class MoveToTarget : MonoBehaviour
{
	[SerializeField] Transform targetTransform = null;
	[SerializeField] float speed = 1;
	[SerializeField] float stoppingDistance = 0.01f;

	void Start ()
	{
		StartCoroutine(MoveToObjectPosition(targetTransform));
	}


	IEnumerator MoveToObjectPosition (Transform location)
	{
		while (location != null)
		{
			transform.position = Vector3.MoveTowards (
				transform.position,
				location.position,
				speed * Time.deltaTime
			);

			float distanceToTarget = Mathf.Abs(Vector3.Distance(transform.position, location.position));
	
			yield return new WaitForEndOfFrame();    
			if (distanceToTarget <= stoppingDistance) {
				yield break;
			}
		}
	}
}

Hope that makes sense let me know :slight_smile: