tatty
1
how would i write a transform.position script using Vector 3,, i already know how to do rotations but i have played around with the script and i cant find how to do it
You put in transform.position = Vector3() or you can put a Vector3 into other transform functions such as Translate(). Note below, you could also create a variable for a Vector3 and insert that into any of these places.
So it might say something like:
function Update () {
//You can say Vector3.up for everyone of these, but for teaching
//purposes I wrote it out.
//Also note you would only use one of these at a time or you would get
//strange results.
transform.position = Vector3(0, 1, 0); //places the object one up in world space.
transform.position += Vector3(0, 1, 0); //more complicated. moves the object up one meter per frame.
transform.Translate(Vector3(0,1,0)); //same as above but using translate instead.
transform.Translate(Vector3(0 , 1, 0) * Time.deltaTime); // Same as above,
//but each component of the Vector is multiplied by 1/FPS to create movement
//in meters per second.
}
The reference also has several examples of Vector3's to check out.