Why does my plane going up when my code is vector3.right, and when my code is vector3.forward why my plane is turning right
I'm studying create with code live and I have a little confused abt this function of two issue above and why does it that? using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerControllerX : MonoBehaviour { public float speed; public float rotationSpeed; public float verticalInput;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
// get the user's vertical input
verticalInput = Input.GetAxis("Vertical");
// move the plane forward at a constant rate
transform.Translate(Vector3.forward * speed * Time.deltaTime);
// tilt the plane up/down based on up/down arrow keys
transform.Rotate(Vector3.right * rotationSpeed * Time.deltaTime);
}
}
Answer by TheHallucinations · May 09, 2020 at 11:50 AM
This is because Vector3.forward uses World position so this means if u turned 90 degrees forward is still de same as if u turned 0 degrees if u want to use local postion use tranform.forward @huyhoangtrank4ac
I'm not clear a lot, you said that "if u turned 90 degrees forward is still de same as if u turned 0 degrees" so it gotta nothing happens
Because of right = (1, 0, 0) so it gotta turn right on the x axis, but when I swap the number it turn down on the y axis :vvv I'm really confused, or it's the convention of Unity ?