Hi TCE! as laserlars refered in his example, you have first to make a reference to the GameObject you want to move, then refer to the “Transform” component of it, and then modify the position, where the Vector3 that contains the 3 coordinates in space are stored.
using UnityEngine;
using System.Collections;
public class findtarget : MonoBehaviour {
public GameObject target;
public Vector3 Destination = new Vector3(0,16,24); //Vector values ar random values for showing purposes
void Start()
{
Move();
}
void Move()
{
target.transform.position = Destination;
}
}
I tried using this to set the rotation aswell because I have a block that falls, tumbles along the ground, but then I want it back to normal again. But when the timer finishes and the transform.position happens, it moves back to the start and rotates wildly in the air.
I used transform.rotation = new Vector3(XRot, YRot, ZRot);
The XRot and so forth are my public floats as I want 1 script for different positioned boxes.