Hi
Two object, call them “red” and “blue”. The aim is if I click “blue”, the “red” moves exactly same position. Right now this move happens instantly, but would like to set the speed to see “red” moving. This is the script attached to “blue”. Any help is appreciated.
using UnityEngine;
using System.Collections;
public class ClickCheck : MonoBehaviour {
public float speed = 1.5f;
private Vector3 target;
void OnMouseUp()
{
target = Camera.main.ScreenToWorldPoint(transform.position);
target.z = transform.position.z;
GameObject.Find("red").transform.position = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
}
}