I know this question has been asked but the answers to this question still yields the same result for me.
void toGround()
{
transform.position = Vector3.MoveTowards (transform.position, pos, Time.deltaTime * speed);**strong text**
if(Vector3.Distance(transform.position, pos) < 0.1f)
DropDown = false;
}
Basically I have a spaceship abducting an object. This method is called in the Update when the ship has left the abduction bounds and now the object is falling back to it’s original position which is pos. When DropDown is set to false, it stops moving to pos, and continues on wandering in another script.
The object does return to it’s position, however it just stays there and does not move. I’ve looked at the objects transforms and it looks like it is infinitiley going towards the new position but never reaching it.
I’ve also tried
if(transform.position.x == pos.x && transform.position.x == pos.y && transform.position.z == pos.z)
However, this yeilds the same result.
What am I doing wrong?