Hi,
i am a student and i am now doing an assignment on unity3d. i really hope i am able to find someone who is able to give me a hand and leading me on how to start on this assignment. As i am really very lost especially when i do not have a javascript background.
oh well, i have a camera and a map on a terrain which can be show in my game scene. Right now, i need my camera to elevate upwards automatically from the base(vector 0,0,0) to point A(vector 500,y,10).(which is shown from my attachment)
i did tried to script it as following however i was unable to get the output. Is it something wrong in my coding? Thanks.
var terrainData : TerrainData;
var speed = 10;
var target: Transform;
var localPosition : Vector3;
var viewPos = Camera.main.transform.localPostion;
function Update()
{
if( viewPos.z < terrainData.size.z viewPos.z > 0 )
{
if (viewPos.x < terrainData.size.x viewPos.x > 0)
{
// Move the object forward along its z axis 1 unit/second.
transform.Translate(Vector3.forward * Time.deltaTime10);
// Move the object upward in world space 1 unit/second.
transform.Translate(Vector3.up * (Time.deltaTime10), Space.World);
}
else
{
transform.Translate(Vector3.zero, Space.World);
}
}
}