Monday, June 27, 2011

Transform.Translate Idea of Moving Platforms

=-========================================================================
Let's create some moving platforms that moves upward and then downward , also lets try moving platforms that moves forward and then backward
==========================================================================From the scripting manual
=========================================================================


function Update() {
// Move the object forward along its z axis 1 unit/second.
transform.Translate(Vector3.forward * Time.deltaTime);

// Move the object upward in world space 1 unit/second.
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
}



==========================================================================
=======================================================================
function Update() {
// Move the object forward along its z axis 1 unit/second.
transform.Translate(0, 0, Time.deltaTime);

// Move the object upward in world space 1 unit/second.
transform.Translate(0, Time.deltaTime, 0, Space.World);
}

========================================================================
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform);
}

================================================================
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform);
}

No comments:

Post a Comment