- Home /
Unsure why I am getting errors
This function is currently giving me 2 errors,
Assets/Scripts/poopingDog.js(78,34): BCE0022: Cannot convert 'UnityEngine.Vector3' to 'System.Type'.
Assets/Scripts/poopingDog.js(85,50): BCE0017: The best overload for the method 'UnityEngine.Vector3.MoveTowards(UnityEngine.Vector3, UnityEngine.Vector3, float)' is not compatible with the argument list '(UnityEngine.Vector3, System.Type, float)'.
But to me it all seems to be correct? What am I doing wrong here?
function Spawn ()
{
animation.Play("Spawn");
yield WaitForSeconds (.8);
animation.Play("Pooping");
yield WaitForSeconds (poopLength);
animation.Play("PoopToRun");
var targetPosition = Vector3;
targetPosition = Vector3(transform.position.x - 1, transform.position.y, transform.position.z );
var t: float = 0.0f;
while(t < 1)
{
t += Time.deltaTime / 2.0;
transform.position = Vector3.MoveTowards (transform.position, targetPosition, t);
yield;
}
yield WaitForSeconds (1.5);
animation.Play("Run");
}
I'm sorry $$anonymous$$ira, you are right, I should have. But you managed to flag down the error! $$anonymous$$aking that small change solved both!
Thanks for the extra pair of eyes, I'm a bit too wired up on coffee right now, and I guess I just missed it!
Convert your comment to an answer!
Answer by KiraSensei · Jan 13, 2014 at 12:59 PM
You should tell us what are lines 78 and 85 because you don't post all of your code.
The first thing I see is :
var targetPosition = Vector3;
Instead of :
var targetPosition:Vector3;
Your answer
Follow this Question
Related Questions
How to make an object move towards an object at a constant pace, no matter how fast the object is? 0 Answers
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
MoveTowards not moving towards! lol. 1 Answer
Jerky Camera or Object motion 1 Answer