Hi im a beginner to Unity3d and i need help with moving object when pressed a button. just take a look at my codings. //Moving Object Forward if (Input.GetAxis("Up")) { transform.Translate(Vector3.forward, Space.Self); } } //Rotating Object Leftwards if (Input.GetAxis("Left")) { transform.Rotate(Vector3(30 * Time.deltaTime, 0, 0), Space.Self); } } The movement forward is fine. but after i rotate, the movement is not forward and the player is moving to the standard axis, not the axis of the player. Help needed. I'm a beginner so please help me! And why isn't the Space.Self working?
Use this Code: Code (csharp): // Rotate around y - axis transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0); // Move forward / backward var forward : Vector3 = transform.TransformDirection(Vector3.forward); [B] //You Missed this Line[/B] var curSpeed : float = speed * Input.GetAxis ("Vertical"); transform.Translate(forward * curSpeed);