Notifications
bg
VK
Vijay Kumar
0
Likes
1
Follower
1
Connection
All
Articles0
Games2
Showcases0
Column2
Jobs0
Hey, hope everyone is doing good.
I would like some help with Challenge 1 Plane. When I press Up and Down it goes left and right rather then what is suppose to do, I know there is something wrong with my script, closest I have reached when I press Up the plane goes Downwards and when Down is pressed it goes Upwards. Can someone please help thanks, here is what my current script is on at the moment:

FollowPlayerX:
public class FollowPlayerX : MonoBehaviour
{

public GameObject playerX;
private Vector3 offset = new Vector3(30, 0, 10);

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
transform.position = playerX.transform.position + offset;

PlayerControllerX:
public class PlayerControllerX : MonoBehaviour
{
private float speed = 30f;
private float turnSpeed = 20f;
private float rotationSpeed;
private float verticalInput;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void LateUpdate()
{
// get the user's vertical input
verticalInput = Input.GetAxis("Vertical");

// move the plane forward at a constant rate
transform.Translate(Vector3.forward * Time.deltaTime * speed);

// tilt the plane up/down based on up/down arrow keys
transform.Rotate(Vector3.up * Time.deltaTime * speed * verticalInput);
}
}

6 months ago
Reply@Adriano SiqueiraHey bro! let me try to helps you. In your last line: // tilt the plane up/down based on up/down arrow keys transform.Rotate(Vector3.up * Time.deltaTime * speed * verticalInput); when you use "Vector3.up" means you want to make a rotation movement aroud the "up-down" vector (It means Vertical or Y axis), so try to change it for "right" and see if it's work.... =) I hope I could help you. good luck ^^
try think it that way: up control = 1 down = -1 and put it to work in your code... =)
VK
6 months ago
Reply@Adriano SiqueiraHey bro! let me try to helps you. In your last line: // tilt the plane up/down based on up/down arrow keys transform.Rotate(Vector3.up * Time.deltaTime * speed * verticalInput); when you use "Vector3.up" means you want to make a rotation movement aroud the "up-down" vector (It means Vertical or Y axis), so try to change it for "right" and see if it's work.... =) I hope I could help you. good luck ^^
Hey thank you Adriano, it worked fine but the only issue I am having now is the controls seems to be inverted. So if I press Up it goes downwards and when I press Down the plane goes Upwards, do you have any idea how to fix that? Thanks again.
VK
6 months ago
Reply@Adriano SiqueiraHey bro! let me try to helps you. In your last line: // tilt the plane up/down based on up/down arrow keys transform.Rotate(Vector3.up * Time.deltaTime * speed * verticalInput); when you use "Vector3.up" means you want to make a rotation movement aroud the "up-down" vector (It means Vertical or Y axis), so try to change it for "right" and see if it's work.... =) I hope I could help you. good luck ^^
Hey thank you Adriano, it worked fine but the only issue I am having now is the controls seems to be inverted. So if I press Up it goes downwards and when I press Down the plane goes Upwards, do you have any idea how to fix that? Thanks again.
6 months ago
Reply@Adriano SiqueiraHey bro! let me try to helps you. In your last line: // tilt the plane up/down based on up/down arrow keys transform.Rotate(Vector3.up * Time.deltaTime * speed * verticalInput); when you use "Vector3.up" means you want to make a rotation movement aroud the "up-down" vector (It means Vertical or Y axis), so try to change it for "right" and see if it's work.... =) I hope I could help you. good luck ^^
around** just one more thing: when you change "Vector3.up" to "Vector3.right" you change the axis of the rotation, around "x" axis instead of "y"
View More Comments
About Me
No description
See more
Skills
No skills added yet
Certifications (0)
Import
See all
Vijay Kumar's liked project (1)
Following (3)
Follower (1)
Following Companies (0)
Not following anyone yet