- Home /
Issue With Vector3 and Transform
So I am currently running into this error
Cannot implicitly convert type 'UnityEngine.Vector3" to 'Unity.Engine.Transfomr'
I am not to sure on how to fix this issue because I am very confused on whats causing this to happen, here's the code where the issue is occurring.
target = pickedNumber.transform.position;
ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step);
Now just in case that's not enough to help me solve the issue here's the for loop that it's in...
float waitTime = 8;
float step = speed * Time.deltaTime * 2;
yield return new WaitForSeconds (waitTime);
for (int i = 0; i <= 19; i++) {
//Finding Game Objects
numbers = GameObject.FindGameObjectsWithTag ("num");
ball = GameObject.FindGameObjectWithTag ("ball");
//Picking the random cube
index = Random.Range (0, numbers.Length);
pickedNumber = numbers [index];
//Moving ball to cube
target = pickedNumber.transform.position;
ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step);
//Pause here
yield return new WaitForSeconds (waitTime);
//Ball Returns to position
ball.transform.position = new Vector3 (0, 0, 0);
}
Answer by Pharaoh_ · Apr 21, 2015 at 04:08 PM
ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step);
Shouldn't this be (transform.position, target, step)?
Your answer
![](https://koobas.hobune.stream/wayback/20220613193702im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Rotating a Vector3 in Instantiation 1 Answer
CharacterController.Move Not Corresponding to gameobject.transform.rotation 1 Answer
Why isn't LateUpdate detecting changes from Update? 1 Answer
this.transform.FindChild(x) and GameObject.Find(x) returning (apparently?) different results 1 Answer