I was “playing” around with this tutorial: http://unity3d.com/learn/tutorials/modules/beginner/scripting/translate-and-rotate
I ended up with this code:
using UnityEngine;
using System.Collections;
public class TranformUp : MonoBehaviour {
public int velocity = 10;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.UpArrow) || Input.GetKeyDown (KeyCode.W))
transform.Translate(new Vector3(0 , 5 ,0) * velocity * Time.deltaTime);
if (Input.GetKeyDown (KeyCode.DownArrow) || Input.GetKeyDown (KeyCode.S))
transform.Translate (new Vector3(0 ,-5, 0) * velocity * Time.deltaTime);
if (Input.GetKeyDown (KeyCode.LeftArrow) || Input.GetKeyDown (KeyCode.A))
transform.Translate (new Vector3(-5, 0, 0) * velocity * Time.deltaTime);
if (Input.GetKeyDown (KeyCode.RightArrow) || Input.GetKeyDown (KeyCode.D))
transform.Translate (new Vector3(5, 0, 0) * velocity * Time.deltaTime);
}
}
What I don’t understand is, that whatever value the variable velocity has, the result is the same.Isn’t it supposed to multiply with the vector3 values?
EDIT: Even setting it to 0 doesn’t change something