Hiya, I tried to make this script designed to make one object follow another and I must have done something wrong, if you could tell me why it doesn’t work that would be great, thanks in advance.
public GameObject followingObject;
public GameObject followedObject;
Vector3 Transport;
public bool alongX;
public bool alongY;
public bool alongZ;
void FixedUpdate () {
if (alongX = true) {
Transport.x = (followedObject.transform.position.x);
} else {
Transport.x = (followingObject.transform.position.x);
}
if (alongY = true) {
Transport.y = (followedObject.transform.position.y);
} else {
Transport.y = (followingObject.transform.position.y);
}
if (alongX = true) {
Transport.z = (followedObject.transform.position.z);
} else {
Transport.z = (followingObject.transform.position.z);
}
}
void LateUpdate () {
followingObject.transform.position = Transport;
}