// Update is called once per frame void Update() { var rocketPosition = rocket.transform.position; int minDistance = 1; if (VArithmetics.GetDistance(transform.position, rocketPosition) > minDistance) { transform.Translate(VArithmetics.GetVelocity(transform.position, rocket.transform.position, 1)); } Debug.Log(VArithmetics.GetDistance(transform.position, rocket.transform.position)); }
public void move(GameObject obj, Counters ast) { if (ast.collisionBool) { obj.transform.Translate(VArithmetics.GetVelocity(obj.transform.position, ast.collisionTemp, astspeed, ast)); } else if (!ast.collisionBool) { obj.transform.Translate(VArithmetics.GetVelocity(rocketShip.transform.position, obj.transform.position, astspeed, ast)); } //stores new position ast.previousFrame = obj.transform.position; ast.objectTemp = obj.transform.position; }