modify z axis unity code example
Example 1: x y and z axis in unity
public float playerspeed =5.0f; // Use this for initialization void Start () { //Player Spawn Point transform.position = new Vector3 (0, 3, 0); } // Update is called once per frame void Update () { transform.Translate (Vector3.right * Input.GetAxis("Horizontal") * playerspeed * Time.deltaTime); transform.Translate (Vector3.forward * Input.GetAxis ("Z") * playerspeed * Time.deltaTime); }
Example 2: change z value unity
Vector3 temp = transform.position;
temp.x = 10.0f;
transform.position = temp;